Format column text in GridView
posted on Tuesday, May 23, 2006 6:21 PM
by
kfinley
I came across an interesting one today. In order to get the DateFormatString property to work on a GridView you must have the HtmlEncode property set to false. If you don't have the HtmlEncode property set the string will simply not format. Here's an example of formating a string to a simple date.
<asp:BoundField DataField="ReleaseDate" HeaderText="Release Date" SortExpression="ReleaseDate" DataFormatString="{0:MM/dd/yyyy}" HtmlEncode="false" />