You can do this when you want to save it to database or direct viewing for example using label. When viewing from database, you don't need to do that anymore.
Programming to simplify, don't look for difficult way
Suwandi - Non Graduate Programmer
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"
"Hi my name is Afzaal.
i am 17 years old."
Right?
Read more of my web development posts on my website. Thank you.
Contributor
4010 Points
1926 Posts
Environment.NewLine
Jul 13, 2013 09:56 AM|Afzaal.Ahmad.Zeeshan|LINK
Hi,
I read a post somewhere saying that to save the TextArea line breaks we need to write this code
But where? Before saving? Or after saving and before viewing?
Star
11795 Points
2340 Posts
Re: Environment.NewLine
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
Contributor
4010 Points
1926 Posts
Re: Environment.NewLine
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>?
All-Star
52523 Points
15675 Posts
Re: Environment.NewLine
Jul 13, 2013 10:40 AM|oned_gk|LINK
Suwandi - Non Graduate Programmer
Contributor
4010 Points
1926 Posts
Re: Environment.NewLine
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>?
All-Star
52523 Points
15675 Posts
Re: Environment.NewLine
Jul 13, 2013 11:06 AM|oned_gk|LINK
Suwandi - Non Graduate Programmer
Contributor
4010 Points
1926 Posts
Re: Environment.NewLine
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"
"Hi my name is Afzaal.
i am 17 years old."
Right?
Star
11795 Points
2340 Posts
Re: Environment.NewLine
Jul 13, 2013 12:09 PM|urenjoy|LINK
Exactly