Render string into HTML output

Reply

Join Date: Dec 2008
Posts: 19
Reputation: dfs3000my is an unknown quantity at this point 
Solved Threads: 0
dfs3000my dfs3000my is offline Offline
Newbie Poster

Render string into HTML output

 
0
  #1
Jan 19th, 2009
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 :

  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!
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 104
Reputation: Aneesh_Argent is an unknown quantity at this point 
Solved Threads: 18
Aneesh_Argent Aneesh_Argent is offline Offline
Junior Poster

Re: Render string into HTML output

 
0
  #2
Jan 19th, 2009
Try this
Response.Write(htmlString );
Last edited by Aneesh_Argent; Jan 19th, 2009 at 6:34 am.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 130
Reputation: sedgey is on a distinguished road 
Solved Threads: 8
sedgey's Avatar
sedgey sedgey is offline Offline
Junior Poster

Re: Render string into HTML output

 
0
  #3
Jan 19th, 2009
you could also add a literal control to your page/user control
  1. <asp:Literal id="litHtml" runat="server"/>

And then assign your html to its text property:

  1. litHtml.Text = "<h3>Hello World</h3><div>Something here</div>";
David Ridgway: so little daylight, too much caffeine
MCSD MCAD MCSE
http://web2asp.net
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2130 | Replies: 2
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC