Grid with DatePicker has display and validate has different format

4 posts, 0 answers
  1. Arvind
    Arvind avatar
    7 posts
    Member since:
    Aug 2016

    Posted 29 Sep Link to this post

    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);
  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 30 Sep Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Arvind
    Arvind avatar
    7 posts
    Member since:
    Aug 2016

    Posted 30 Sep in reply to Viktor Tachev Link to this post

    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.

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 03 Oct Link to this post

    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready