GridView控件是修剪前导空格。我可以停止? [英] GridView is trimming leading spaces. Can I stop that?

查看:99
本文介绍了GridView控件是修剪前导空格。我可以停止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GridView控件在ASP.NET 2.0修整与数据从SQLServer数据库来的前导空格。我还没有找到一种方法来阻止它这样做。在这个特殊的视图中的数据被修改,以去除这样的空间,但只有在编辑该行可以在任何前导空格可以看出,含义,在present,每一行都将不得不感动。随着12000行,这是一个有点多。

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.

一点点我在谷歌找到了主要与修剪前导空格关注。有没有办法强制GridView的准确显示数据,因为它是在数据库中,前导空格和所有?

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.

迈克尔

推荐答案

怎么样,当你绑定您的数据,以取代所有 字符&放大器; NBSP; 。您可以用OnRowDataBound事件或通过DataFormatString做到这一点(这里有一个相关的例子

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

这篇关于GridView控件是修剪前导空格。我可以停止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆