Solved

Gridview Update Strips Carriage Returns CHAR(13)

Posted on 2011-03-22
5
1,034 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:rito1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 35191010
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
 
LVL 1

Author Comment

by:rito1
ID: 35191131
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
 
LVL 1

Accepted Solution

by:
rito1 earned 0 total points
ID: 35239659
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
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 35239669
Wierd, glad to hear you got it sorted out.
0
 
LVL 1

Author Closing Comment

by:rito1
ID: 35356734
The issue was related to CSS rather than Gridview binding.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question