asp.net - textarea save wont save with breakline -


i have textarea , want present it. want text saved same break lines or \n.

but wouldnt.

heres code :

string content = request.form["content"];           content =  system.web.httputility.htmlencode(content);           updatecontent(content, id);   public void updatecontent(string content, string id) {     sql = "update tbl_zac_squares set lotstext =@lotstext id = " + id;      connection = new sqlconnection(conn);     connection.open();      cmd = new sqlcommand(sql, connection);     cmd.parameters.addwithvalue("@lotstext", content);      cmd.executenonquery();      connection.close(); } 

then present :

<td align="right" style="padding: 12px; font-family: arial; font-size: 12pt; color: #000000">                                         <div >     <%=dt_details.rows[0][9].tostring() %></div>                                         </td> 

you encode content before saving in database have decode before showing in page///...so can try this...

 <div ><%=system.web.httputility.htmldecode(dt_details.rows[0][9].tostring()) %></div>                                         </td> 

and before encoding content write...

content=content.replace(enviroment.newline,"<br/>"); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -