gabsferreira
gabsferreira

Reputation: 3137

Display html text as html

There's a moment in my page where I connect to a database and retrieve some data. One field in special is html code. I want to display it in my page as html inside some control that understands it. What are my options?

Upvotes: 0

Views: 648

Answers (1)

Thousand
Thousand

Reputation: 6638

Use a literal.

.aspx:

<asp:Literal runat="server" ID="myLiteral" />

codebehind:

myLiteral.Text = "<h2> this is a h2 html tag</h2>";

this will print out

This is a h2 html tag

Upvotes: 2

Related Questions