开发者

SQL Server 2008 Time column messing up GridView DataFormatString

I've got a nullable column in SQL Server 2008 that I use to store a time. When I use LINQ to SQL and pull data back it comes back as TimeSpan?. When I bind that to a GridView and try to forma开发者_运维问答t it using DataFormatString="{0:t}" it still shows the seconds. Any thoughts?


The problem is that TimeSpan doesn't implement IFormatable. So you can't directly format TimeSpans.


Make sure you also disable Html encoding for your format to work.

HtmlEncode="false"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜