943,708 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 8409
  • ASP.NET RSS
Jan 19th, 2009
0

Render string into HTML output

Expand Post »
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 :

ASP.NET Syntax (Toggle Plain Text)
  1. Dim htmlString As String = "<h3>Hello World</h3><div>Something here</div>
  2.  

I am not too sure how can it be done. Thanks in advance!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dfs3000my is offline Offline
21 posts
since Dec 2008
Jan 19th, 2009
0

Re: Render string into HTML output

Try this
Response.Write(htmlString );
Last edited by Aneesh_Argent; Jan 19th, 2009 at 6:34 am.
Reputation Points: 16
Solved Threads: 18
Junior Poster
Aneesh_Argent is offline Offline
104 posts
since Dec 2008
Jan 19th, 2009
0

Re: Render string into HTML output

you could also add a literal control to your page/user control
ASP.NET Syntax (Toggle Plain Text)
  1. <asp:Literal id="litHtml" runat="server"/>

And then assign your html to its text property:

ASP.NET Syntax (Toggle Plain Text)
  1. litHtml.Text = "<h3>Hello World</h3><div>Something here</div>";
Reputation Points: 68
Solved Threads: 9
Junior Poster
sedgey is offline Offline
130 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: embed ms word tools in application
Next Thread in ASP.NET Forum Timeline: displaying database total in a label





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC