Solved

Gridview Update Strips Carriage Returns CHAR(13)

Posted on 2011-03-22
5
1,035 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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