Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Dear All,

I have typical problem with TextArea/Textbox for showing multiple line.

from my database value is coming as below

"Dear xyz \r\n hope u r good \r\n how about ur health \r\n ...."

when is binding to the control is also OK ,i have seen in the Quick watch/Immediate window.

But when i am looking in the final output page in Browser (IE11) it is showing in a single Line.
It's happening with Text box as well as text area and in chrome also same error.

Please help in this

Thanks
Vamsi
Posted
Comments
[no name] 6-Feb-14 5:07am    
Re: Multiline textbox text newline
Aug 21, 2005 02:52 PM|LINK

Coming out of the database, any newlines should be replaced by <br> tag

Going into the database, any <br> tags should be replaced by a newline. For VB.NET, this is vbCrLf, for C# it is \r\n (or \n seems to work), and for a lanugage-agnostic solution use System.Environment.NewLine.
[no name] 9-Feb-14 13:23pm    
You are right

Hi here the solution what exactly "PBGuy" tried to explain you..

newlines should be replaced by <br> tag

str.Replace(@"\r\n", "
");

or

string result = Regex.Replace(input, @"\r\n?|\n", "
");

Regards,
Praveen Nelge
 
Share this answer
 
use '@' sign before ur string.
@"Dear xyz \r\n hope u r good \r\n how about ur health \r\n ...."

hope this will solve ur problem

Regards,
Sumit.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900