Format a Date in a DataGrid

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
 
W

Wayne Wengert

Anatoly;

- Perfect! Works like a charm.

Where is that sort of thing documented?

Wayne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Date Won't Format 1
Edit Buttons in a datagrid 2
Hiding item in DataGrid 1
Format Date in DataGrid 2
Display An Image In A Datagrid Dynamically 1
Format Date in a DataGrid 2
Format DataGrid Text 4
Date format 3

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top