Reputation: 203
I want to show some html string in text in my asp web, however it is creating some html object.
mylab.Text = "<br/>";
Upvotes: 1
Views: 2178
Reputation: 3149
You can do the following easily:
Default.aspx:
<asp:Label ID="Label1" runat="server"></asp:Label>
Finally do the following:
Default.aspx.cs:
Label1.Text = Server.HtmlEncode("<title>ASP.NET Tutorial - Label Display HTML</title><br/>");
For more, see this: Display HTML Tags in an ASP.NET Label
Upvotes: 1