views:

66

answers:

2

I have multiline textbox in ASP.NET which renders to a textarea element. I set the Text property to a string like

test\r\n\r\n\r\ntest2

but it only renders like

test
test2

in the textarea while I expected something like this to be rendered:

test


test2

It seems the textarea eats the whitelines. How to overcome this?

+1  A: 

That is a behaviour of html rendering - when you have consecutive white space then only the first instance gets rendered. In your case you could replace the CRLFs with a break tag instead (Thats a 'br' between angle brackets, i'm not quite sure how to get it to render correctly within the post).

slugster
Lets seee if it renders properly in the comment: you want this html tag <br/>
slugster
A: 

Turned out to be that somewhere in the pipeline was a whitespace remover installed which also ate the whitelines in the textarea.

Nyla Pareska