I have an ASP.NET 3.5 application with a gridview in a page.
I want to format one of the columns as a datetime. I've tried:
<asp:BoundField DataField="StatusDate" HeaderText="as of" SortExpression="StatusDate" DataFormatString="{0:d}" />
The problem is no matter what I do, my formatting never changes. I've tried the other date formatting strings (general, sortable, longdate, the list goes on), but the format of this column never changes.
I don't think I'm doing anything wrong, but this is driving me nuts when I try to sort based on this column. Because the default is formatting the column as a string, it doesn't sort correctly when I sort by the column header.
Anyone seen this and have some kind of workaround? I've seen articles mentioning adding a custom sort method, but I'm trying to stick to out-of-the-box functionality if I can.