c# - Response.Write print text from database as HTML -


i'm storing text textarea database. text can contain new lines, special characters etc. want make sure when show using response.write, comes out if show in textarea control. reason why want because want give user print view form. solution below not work. using asp.net/c#

e.g

foreach (datarow row in dview.table.rows) { response.write("<tr>");                     response.write(string.format("<td>{0}<br/><br/></td>",   row[1].tostring().replace("\n", "<br/>")));                     response.write("</tr>"); 

thanks

don't way, you'll run problems, when quotes , symbols involved.

store data :

 httputility.htmlencode("<p>lorem ipsum ...</p>"); //your html encode goes here 

and retrieve this:

myplaceholder.text = httputility.htmldecode(mydata); 

here's little more information on htmlencode/decode


Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -