views:

41

answers:

1

The GridView in ASP.NET 2.0 is trimming the leading spaces from data coming from a SQLServer database. I have yet to find a way to keep it from doing that. The data in this particular view is being edited to remove such spaces, but only upon editing the row can any leading spaces be seen, meaning, at present, each row will have to be touched. With 12,000+ rows, that's a little much.

What little I've found on Google has mainly be concerned with trimming leading spaces. Is there a way to force GridView to show the data exactly as it is in the database, leading spaces and all?

Thanks in advance for any help.

Michael

+1  A: 

How about, when you bind your data, replace all '' characters with ' '. You can do this with a OnRowDataBound event or through DataFormatString (here's a relevant example).

rlb.usa
Well, I tried that, but could not, for the life of me, get it to work. So I went with another route. (Namely, wrapping the contents of the cell in <pre> tags, which is the other solution I found online.)Thank you for the help, though.
Michael Howland