Solved

Gridview Update Strips Carriage Returns CHAR(13)

Posted on 2011-03-22
5
1,025 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
  • 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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now