开发者

GridView is trimming leading spaces. Can I stop that?

开发者 https://www.devze.com 2022-12-25 03:07 出处:网络
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 vie

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消