Click to See Complete Forum and Search --> : Problem with GridView Date Format


MCRoberts
December 2nd, 2008, 11:16 AM
Greetings:

I've got this very strange problem with a GridView. It contains a column of Date / Time. I specified the DataFormatString of the BoundField thusly:

bf.DataFormatString = "{0:MMM dd, yyyy HH:mm:ss}";

This should produce a date / time that looks like this: Nov 28, 2008 09:40:57

When I run the web site under Visual Studio, it works. I get the expected date / time format. However, when I upload the application to the target server and then access it through a web browser in the usual way, the date / time is formatted as: "11/28/08 09:40:57".

In fact, it always formats that way no matter how I set the format string.
:ehh:
Can anybody help with this one?
Thank you,
Mark

Thread1
December 3rd, 2008, 03:37 AM
have you tried to set the HtmlEncode property to false?

MCRoberts
December 3rd, 2008, 09:05 AM
No, I hadn't done that.

It works now. Thanks!

I do not understand why it worked when I ran it under Visual Studio but not when I uploaded to the server...

Very strange...
Thanks again,
Mark