Initial Draft
created on 11/5/2007 at 3:04 PM by jguadagno
Number of Views
1385
Description
The answer is simple... Set the DataFormatString property of the BoundField to the desired format and set the HtmlEncode property to false (as outlined below).
Replace the ColumnName value with the name of your column.
Replace DataFormatString property with the format string of your choosing. A good reference for .NET string formats is available at http://john-sheehan.com/blog/index.php/net-cheat-sheets/
<asp :GridView ID=“GridView1″ runat=“server”>
<columns>
<asp :BoundField DataField=“ColumnName”
DataFormatString=“{0:M-dd-yyyy}”
HtmlEncode=“false”
HeaderText=“ColumnName” />
</columns>
</asp:GridView>