DateTime save in UK format

3 replies. Last post: February 18, 2011 4:29 PM by Handy Surya
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

Hi Guys,


I'm having problems with the WebGrid and culture en-GB.  If I set the culture to custom and en-GB all the text is missing for menus etc. I assume the resource for en-GB hasn't been included in the dll.  However my problem is when I want to save UK date formats for the ObjectDataSource update method. I really don't want to have to write something to parse all the values from the web grid myself.


I'm using my columns like this:

<ISWebGrid:WebGridColumn Caption="Valid To" DataMember="ValidTo" 
                    DataType="System.DateTime" Name="ValidTo" Width="100px" 
                    EditType="CalendarCombo" DataFormatString="dd/MM/yyyy">
                </ISWebGrid:WebGridColumn>

 The culture of my application is set to en-GB in the web.config as follows:

<globalization uiCulture="en-GB" culture="en-GB"/>

So when the grid renders I get 24/07/2011 for example.  When I use the Calendar Combo to select the date I get the correct format again.  However when I save the row (I'm using batch update) I get the following javascript error:

Message Title: Message from webpage

Message Text:

WebGrid failed to update 1 out of 1 changes due to errors.  Please review and correct your changes.

The following records were not updated
-Record " : Cannot convert value of parameter 'ValidTo' from 'System.String' to 'System.DateTime'"

Obviously if I use a date such as 01 Feb 2011 it saves but switches to 02 Jan 2011.


Thanks for any help


Paul

All times are GMT -5. The time now is 11:15 AM.
Previous Next