开发者

Textarea doesn't show newline in IE

Looks like IE ignores \r\n in text when the text is placed into a textarea. Here's how it looks in FF/Chrome/Opera:

Paragraph1 sometext
Paragraph2 ot开发者_如何学Pythonhertext

And in IE7/8:

Paragraph1 sometextParagraph2 othertext

I tried changing "new-line" css parameter with no luck. Any ideas what might be wrong?

I use asp.net as back end, where I assign that text to the textarea, but I doubt it's relevant.

UPDATE: Seems like it's asp.net that is rendering asp:TextArea differently for different browsers - for IE it seems to ignore newline characters. When I replace asp:TextBox with textarea, I get correct results. Any ideas how to fix that?


A newline is \r\n, not \n\r. Yes, it makes a difference.


textbox with "MultiLine" set to "TextMode" is the rendering to so this is not the problem...


I had the same issue, where if specifying the width for the TextBox that was marked as TextMode="MultiLine" was causing the above behavior. I solved it manually specifying Rows and Columns properties of the textbox.


Turns out that my problem has nothing to do with the textarea itself, but rather with the way I'm escaping the output and unescaping the input. I'll open another question for that problem.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜