开发者

textarea removes whitelines?

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开发者_StackOverflow社区 I expected something like this to be rendered:

test


test2

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


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).


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜