BoundColumn DataFormatString questions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a DataGrid in a ASP.NET application (.NET 1.1) where one of the
BoundColumns in the datagrid is displaying a Date and Time stamp. I would
like to display just a short date ("7/5/2005") instead of the full date and
time. I am having difficulty understanding the DataFormatString property on
the BoundColumn class. I see in the documentation how to change the format
for numbers, but don't see how to change the format for dates.

Any suggestions would be greatly appreciated.

Regards,
Jeff
 
Hi Jeff,

Thank you for your post.

Based on my understanding, your question is how to format a bound column of
DataGrid to show with your specified date format. If I've misunderstood
anything, please feel free to post here.

You can use following code as an example:

<asp:BoundColumn DataField="Birthdate" DataFormatString="{0:M'/'d'/'yyyy}"
HeaderText="Test"></asp:BoundColumn>

For more information on date format string, you can check out following
MSDN Library documentation:

#Date and Time Format String
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconcustomdatetimeformatstrings.asp

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Back
Top