Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1051
  • Last Modified:

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
0
rito1
Asked:
rito1
  • 3
  • 2
1 Solution
 
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
 
rito1Author 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:
Wierd, glad to hear you got it sorted out.
0
 
rito1Author Commented:
The issue was related to CSS rather than Gridview binding.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now