ASP.NET GridView issue with DataFormatString in a BoundField

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-06-16T20:48:19Z Indexed on 2010/06/16 20:52 UTC
Read the original article Hit count: 289

Filed under:

I have a BoundField in a GridView whose datatype (in MSSQL) is time(7). The format is being displayed as:

hh:mm:ss.xxxxxx

I want to add a DataFormatString to this boundfield so that the field displays in the format:

hh:mm:ss

Here is a snippet of the .aspx file that I'm modifying:

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

SortExpression="ProcTime" ApplyFormatInEditMode="true" HtmlEncode="true" DataFormatString="{0:F0}" />

I've tried many different format strings (t, T, d, D, m, etc) but it does not change the format of the boundfield.

What am I missing?

© Stack Overflow or respective owner

Related posts about ASP.NET