Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在边界字段中出现DataFormatString的ASP.NET GridView问题_Asp.net - Fatal编程技术网

在边界字段中出现DataFormatString的ASP.NET GridView问题

在边界字段中出现DataFormatString的ASP.NET GridView问题,asp.net,Asp.net,我在GridView中有一个BoundField,它的数据类型(在MSSQL中)是time(7)。格式显示为: hh:mm:ss.xxxxxx 我想将DataFormatString添加到此boundfield,以便该字段以以下格式显示: hh:mm:ss 下面是我正在修改的.aspx文件的一个片段: <asp:BoundField DataField="ProcTime" HeaderText="ProcTime" 我尝试了许多不同格式的字符串(t、t、d、d、m等),但它不会更改b

我在GridView中有一个BoundField,它的数据类型(在MSSQL中)是time(7)。格式显示为:

hh:mm:ss.xxxxxx

我想将DataFormatString添加到此boundfield,以便该字段以以下格式显示:

hh:mm:ss

下面是我正在修改的.aspx文件的一个片段:

<asp:BoundField DataField="ProcTime" HeaderText="ProcTime"

我尝试了许多不同格式的字符串(t、t、d、d、m等),但它不会更改boundfield的格式


我遗漏了什么?

因为您只格式化了一个值,而不是一组值,您不需要指定要使用的值。所以格式“{0:F0}”变成了“{F0}”

我猜出来了(链接给出了一个更深入的示例)


简而言之,我需要向GridView添加一个事件处理程序,当“OnRowDataBound”事件发生时触发该事件处理程序。然后,此事件处理程序将负责更改单元格中文本的格式。

这似乎没有多大区别。