This is a migrated thread and some comments may be shown as answers.

Grid with DatePicker has display and validate has different format

3 Answers 273 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Arvind
Top achievements
Rank 1
Arvind asked on 29 Sep 2016, 03:48 PM

I am using a Grid having a date picker in one of the column, when the date picker is displayed in the edit mode, the date is in "dd/MM/YYYY" format so when i select a date in it displays in "dd/MM/YYYY" format but when i update with a date say 29/09/2016 i get invalid date validation error from the control, and if i change it to say 09/209/2016 it works, so the validation it does is for "MM/dd/YYYY" format.  I have not added any custom validation for this, is there there any place that i need to handle this that i am doing it wrong?

 

columns.Bound(p => p.MyDate).Title("Date").EditorTemplateName("Date").Format("{0:dddd dd MMMM yyyy}").Filterable(false).Width(160);

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 30 Sep 2016, 01:00 PM
Hello,

Please ensure that the culture that is set on the server is accepting the date format that is specified. If you would like additional information on globalization for the components you would find the article below interesting.



Regards,
Viktor Tachev
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Arvind
Top achievements
Rank 1
answered on 30 Sep 2016, 03:22 PM

Thanks lot for the response.

Sorry for my ignorance. I am running the code on my local machine, and my machine culture is set to English(GB). I even included the culture script file to the project, but yet the date picker when displayed and when i select the date it uses the correct format, but the default validation run fails as it is run fro "mm/DD/YYYY" format seems to be using a wrong culture, i even verified the CultureInfo data from the server side and it seems to work fine. 

Also If i select the date as 10/09/2016 and pass it to the server side, the dateTime contains the date as 09/10/2016.

0
Viktor Tachev
Telerik team
answered on 03 Oct 2016, 12:19 PM
Hello Arvind,

Please ensure that the client- and server-side cultures match as described in the article from my previous post.

Moreover, please examine the following article that describes how you can set the same culture on the server and client.



Regards,
Viktor Tachev
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Arvind
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Arvind
Top achievements
Rank 1
Share this question
or