<asp:Textbox> <enter> key (CR) can't be save to a database

G

Gabriel

I not to be able to store the carriage return from a multiline textbox
control on my web application.

So when the data is displayed back from the database there are no carriage
return. All the lines are displayed as a single long line.

I've check the database (MSSQL 2008) and it doesn't seem to be storing it.
But if I save the information from a textbox using a winform everything is
stored correctly.

Does anyone have any suggestions to help me solve this problem?

I am using Visual Studio 2008. C# in a web application running from IIS 6.0

Thanks.
 
G

Guest

when the save process begins, try doing this ;

string val = textbox1.Text.replace("\r\n","<br />");

or when you retrive the data from database ;

textbox1.Text =  dbValue.replace("\r\n","<br />");

To check if it is there, either switch to text output (grid is by
default) or make a select like

select replace(mytexfield, CHAR(13)+CHAR(10), '** I AM HERE **') from
mytable
 

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

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top