5

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 othertext

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?

Andrey
  • 20,487
  • 26
  • 108
  • 176
  • 1
    Do you see the newline if you look at the page's source code? That will let you see if it's a back-end or a front-end problem. – pau.moreno Apr 16 '11 at 23:38
  • Hm, When I look at the source, I see new lines in Chrome, but not in IE. Might it be IE not giving me the correct source code? I doubt asp.net renders text differently for different browsers. – Andrey Apr 16 '11 at 23:42
  • Perhaps you should show the code where you set the text to the textbox. – Erik Funkenbusch Apr 16 '11 at 23:48
  • @Mystere Man: txtMemberObjectives.Text = "Paragraph1 sometext\r\nParagraph2 othertext"; – Andrey Apr 16 '11 at 23:51
  • Ok, so is txtMemberObjectives an html ` – Erik Funkenbusch Apr 16 '11 at 23:59
  • It's a multiline asp:TextBox. Actually, it seems like it's being rendered differently in IE than in FF/Chrome - when I replace asp:TextBox with server side textarea, it shows correctly. – Andrey Apr 17 '11 at 00:02

4 Answers4

0

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

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
0

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

liron
  • 375
  • 2
  • 12
0

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.

Dimitri
  • 6,923
  • 4
  • 35
  • 49
0

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.

Andrey
  • 20,487
  • 26
  • 108
  • 176