Wednesday, March 05, 2008

ASP.NET Tips #1 - Formatting Bound Columns to short date

I am back doing web development with my current contract, so thought I would post some quick tips as I came across things that may not be obvious.

This is fairly easy, but a good way to start. Say you have a date column that is displaying the time, but you only want to show the short date.

On the column set the DataFormatString to "{0:d}" and set HtmlEncode="false". Job Done.

Example:

No comments: