Hi all,

I have a question. How do I render a string which has some html coding in it and display it as HTML?

For instance, my string is like this :

Dim htmlString As String = "<h3>Hello World</h3><div>Something here</div>

I am not too sure how can it be done. Thanks in advance! :)

you could also add a literal control to your page/user control

<asp:Literal id="litHtml" runat="server"/>

And then assign your html to its text property:

litHtml.Text = "<h3>Hello World</h3><div>Something here</div>";
commented: thanks +0

you could also add a literal control to your page/user control

<asp:Literal id="litHtml" runat="server"/>
And then assign your html to its text property:

litHtml.Text = "<h3>Hello World</h3><div>Something here</div>";
good job .This code is running.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.