Gridview Update Strips Carriage Returns CHAR(13)

Hi All,

I am using a Gridview Control. I edit a record which uses a text box, when I save it it seems to strip out any carriage returns (CHAR(13)) that were there before.

I am simply using an Gridview and SQLDataSource Update command and the text box contains NVARCHAR data.

Interesting, when I first add this record using a web form, I use a similar multi line textbox and it preserves any carriage returns that are added.

Any ideas at all?

Thanks,

Rit
LVL 1
rito1Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
rito1Connect With a Mentor Author Commented:
Hi AndyAinscow, strangely it was to do with the style tag I had applied to the Textbox which was causing it to ignore the line break.

Rit
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
How do you test it?  In other words how do you know it is that character that is being stripped out at the save operation?
0
 
rito1Author Commented:
As soon as I have inserted a new record which preserves the carriage returns I then test the record by returning the data using the following SQL...

SELECT

REPLACE(PageDesc, CHAR(13), '<br />') AS PageDescHTML

FROM MyTable

Where ID = 50

After updating the same record within my Gridview control and run the same SQL, there are no '<br />' tags being replaced.

Thanks,

Rit
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
Wierd, glad to hear you got it sorted out.
0
 
rito1Author Commented:
The issue was related to CSS rather than Gridview binding.
0
All Courses

From novice to tech pro — start learning today.