Format a Date in a DataGrid

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

I want to format a date field in a DataGrid column as mm/dd/yyyy. I am using
the following code:

<asp:DataGrid id="DataGrid1" AutoGenerateColumns="false"
EnableViewState="False" runat="server">
<columns>
<asp:BoundColumn DataField="RegionalID" />
<asp:BoundColumn DataField="StartDate"
DataFormatString="{d}" />
</columns>
</asp:DataGrid>

but I keep getting an error that it is not in the right format. Can anyone
point me to information about formatting a date in this instance. The book I
have shows the formatting for currency but not for dates and obviously I
didn't adapt it correctly.

Wayne
 
Anatoly;

- Perfect! Works like a charm.

Where is that sort of thing documented?

Wayne
 
Back
Top