GridView is trimming leading spaces. Can I stop that?
The GridView in ASP.NET 2.0 is trimming the leading spaces from data coming from a SQLServer database. I have y开发者_Go百科et 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
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).
精彩评论