好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

asp.net DataFormatString格式化GridView

在.net中,查了半天msdn,发现使用DataFormatString是可以实现这个功能的,但是怎么设置就不起作用,最后发现,由于2.0出于安全性的考虑,还要同时设置HtmlEncode = false,才能够使DataFormatString生效.

留个记号,下次用的时候,就不用浪费N多时间了. 还有,DataFormatString = "{0:F}",是默认格式,显示两位小数,如果需要显示的小数位数为其他值,DataFormatString = "{0:Fn}"即可.
代码如下:
DataFormatString="{0:格式字符串}"

在DataFormatString 中的 {0} 表示数据本身,而在冒号后面的格式字符串代表所们希望数据显示的格式;

查看更多关于asp.net DataFormatString格式化GridView的详细内容...

  阅读:54次