Last post Jul 13, 2013 12:09 PM by urenjoy
Jul 13, 2013 09:56 AM|Afzaal.Ahmad.Zeeshan|LINK
I read a post somewhere saying that to save the TextArea line breaks we need to write this code
txtArea.Text = input.Replace(Environment.NewLine, "<br />");
But where? Before saving? Or after saving and before viewing?
Jul 13, 2013 10:04 AM|urenjoy|LINK
What it looks...
In the database textarea text is saved with \n ...etc.
Now you have to display on page after replacing line breaks to <br/>
It should be label to display in readonly mode
lblArea.Text = input.Replace(Environment.NewLine, "<br />");
Jul 13, 2013 10:31 AM|Afzaal.Ahmad.Zeeshan|LINK
Ok, so you mean I need to extract the data as variable and then replace '\n' with <br>?
Jul 13, 2013 10:40 AM|oned_gk|LINK
Jul 13, 2013 10:42 AM|Afzaal.Ahmad.Zeeshan|LINK
Ok, one answer please!
If the text saved in Database contains <br> and when i write it in some div, will that <br> transform into a <br> or it will still be a text <br>?
Jul 13, 2013 11:06 AM|oned_gk|LINK
Jul 13, 2013 12:07 PM|Afzaal.Ahmad.Zeeshan|LINK
You mean by writing this in textarea
"Hi my name is Afzaal.
i am 17 years old."
Will be "Hi my name is Afzaal.\n i am 17 years old." Then to save it if I do that replace, I will get the value as: "Hi my name is Afzaal.<br /> i am 17 years old." And when being executed at browser it will be again as"
Jul 13, 2013 12:09 PM|urenjoy|LINK