views:

43

answers:

1

Ho do I preserve the layout of text in a TextArea control in asp.net ?

e.g.

"This is some text:
     - line 1 text
     - line 2 text
     - line 3 text"

A: 

asked this so i post the answer, as I couldnt find it anywhere else online...

You just need to prefix the text string with '@' and the text will retain its layout. e.g.:

<%=Html.TextArea("sample", @"This is some text:
     - line 1 text
     - line 2 text
     - line 3 text", 10, 20, null)%>

Mark Worrall