ENTER key in TextBox in ASP.NET 2.0

B

Benson Wong

I add a TextBox with TextMode="MultiLine" so that I can input multilines to
the textbox. That's fine.

When user input <ENTER> as a new line, it is ok during input to the textbox,
but not ok when the textbox content is saved to database (<ENTER> character
seems to be ignored, no new line appears when the data is saved to
database).

Any hints.
Benson
 
P

Patrice

How do you know ? Newlines could be honored or not depending how you display
those data. In particular keep in mind that newlines are not significant
when using HTML i.e. you'll have to replace those with the br tag to see a
visible effect.
 
A

Aidy

When you show the data on the page replace carriage returns with <br/>

myText.Replace ("\r\n", "<br/>");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top