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

  • Thread starter Thread starter Gabriel
  • Start date Start date
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.
 
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
 
Back
Top