Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 30, 2008 03:56 AM by Jigarpatel
Apr 28, 2008 12:00 PM|LINK
Lets say I have a multiline
textbox and a user types a message in there. I want to save the message in the
preserve formatting when the message is displayed at a later
time. I'm currently storing the message as an
nvarchar but none of the formatting line breaks get
preserved. Any ideas on how to do this?
Apr 28, 2008 12:15 PM|LINK
Apr 30, 2008 03:33 AM|LINK
If you input some text into textbox, and save the message in the database.
You should handler the message before saving the message into database.
temp = Server.HtmlEncode(temp);
temp = temp.Replace(" "," ");
temp = temp.Replace("\r\n","<br>");
Then you can save it into database, and display it, it will ok.
Let me know if I have misunderstood what you mean.
Hope it helps,
Apr 30, 2008 03:56 AM|LINK
Do like this...
s = txtMultiLine1.Text.Replace(Environment.NewLine, "<br />");
// save this string s to your database in place of multiline textbox string
if this post helps you..
"Mark as Answer"