Earth
Earth

Reputation: 3571

Use angular brackets in label

In VB.NET Label,

lblNotification.Text = send email to <[email protected]> me

O/P I am getting as send email to me and it not displays the <[email protected]>. How to display the full text including angular brackets. That is, I need to get the O/P as send email to <[email protected]> me. Thanks.

Upvotes: 2

Views: 2480

Answers (3)

platon
platon

Reputation: 5340

Use the following code:

Protected Overrides Sub OnLoad(ByVal e As EventArgs)
    MyBase.OnLoad(e)
    Label1.Text = HttpUtility.HtmlEncode("send email to <[email protected]> me")
End Sub

The HttpUtility.HtmlEncode method will automatically convert your string to html encoded text

Upvotes: 4

andy
andy

Reputation: 6079

You can use the &lt and &gt like below

<asp:Label runat="server" ID="lblNotification" Text="send email to 
&amp;lt;[email protected]&amp;gt me;" />

Upvotes: 1

TechDo
TechDo

Reputation: 18649

You can use &lt; instead of < and &gt; instead of >. So your text should be send email to &lt;[email protected]&gt; me

Upvotes: 2

Related Questions