开发者

textarea removes whitelines?

开发者 https://www.devze.com 2022-12-12 00:04 出处:网络
I have multiline textbox in ASP.NET which renders to a textarea element. I set the Text property to a string like

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

精彩评论

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