I've had this problem a few times so I thought I'd actually get round to blogging it.
Displaying Dates on a Datagrid is a nightmare when you don't want to display the full date and time in dd/mm/yyyy hh:mm:ss format.
There is a useful little property in the datagrid items editor which allows you to specify the format of the string using {0:d} formatting.
The problem I've found was that no matter what I did, it didn't make a bit of difference to the output. The solution after much googling was was set one of the other properties..
The trick is to set HTMLEncode to False - as if by magic it works.
Actually it's not magic - the reason it works is that by default your data is html-encoded before the string formatting is applied - switching off html-encoding stops this happening and allows you to format it how you wish - this post explains in more detail:
http://tinyurl.com/hx8jb
Blogged with Flock
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5