I have a GridView in ASP.net which is filled from an SqlDataSource.
one of the columns in the DB table is a Datetime which is set to 30/04/2009, when i show the grid view in asp it appears as 30/04/2009.(which is fine)
however when I hit edit on the row in the grid view, and then hit update without changing the date I get an SQL error which says essentially that the date format is wrong. This is because it thinks that the 30 is refering to the month rather than the day.
I have tried resolving this by setting the <%@ Page uiCulture=”en-gb” culture=”en-gb” %>
but with no effect.
any ideas?
When date is bound to GridView, it is already a
Stringand no more aDateTime. I suggest you set theDataFormatStringof the column to{0:d}, which will display the date based on the page UI.