tags:

views:

265

answers:

2

Hi, I have a textbox multiline for insert text in my db. This text is viewed in a div, but without newlines.

How can I view the newline in my text?

thanks

+1  A: 

Use the following:

myText = myText.Replace(Environment.NewLine, "<br />");

to replace newline characters with proper HTML line-breaks.

Best wishes,
Fabian

halfdan
thank but i receive this error'System.Environment' does not contain a definition for 'Newline'
Luca Romagnoli
Woops, that's a typo. It's Environment.NewLine - with an upper case L.
halfdan
+1  A: 

Put your text inside <div><pre>... text ...</pre></div>. pre tag preserves line breaks.

Tadas