starky(爱在西元前) 2007 Blog  
去生活就像这个世界便是天堂^_^

在GridView 的属性中,将某个column设置为:

DataFormatString="{0:yyyy-MM-dd}"  
发现格式化并没有起作用,同时修改
HtmlEncode="False"
才会发生作用, 为什么呢?

google了一下,发现了微软的说明,还有这里有更详细的解释:

When the HtmlEncode property is true, the value of the field is HTML encoded to its string representation before the formatting string is applied. For some objects, such as dates, you might want to control how the object is displayed with a formatting string. In those cases, you must set the HtmlEncode property to false.

posted on 2006-03-15 10:19  爱在西元前  阅读(1115)  评论(1编辑  收藏  举报