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

Wrong validation. Declare valid date as invalid

1 Answer 206 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Oliver
Top achievements
Rank 1
Oliver asked on 06 May 2013, 01:47 PM
Hello Guys.

Im trying to use the Kendo Date Picker (Not DateTimePicker)

I use it in ASP.Net MVC 4 with Razor 2. In my Model it looks like this :

[Required(ErrorMessageResourceName = "GeburtstagFehlt", ErrorMessageResourceType = typeof(Resources.Shared.ValidationMessages))]
       [Display(Name = "Geburtstag", ResourceType = typeof(Resources.Models.Kontakt))]
       [DataType(DataType.Date, ErrorMessageResourceName = "GeburtstagUngueltig", ErrorMessageResourceType = typeof(Resources.Shared.ValidationMessages))]
       public DateTime Geburtstag { get; set; }
In View:
@model DateTime?
 
@(Html.Kendo().DatePickerFor(m => m))


When i post the Form it show a Validation Failure but the Date is valid.

I am use the swiss/german format dd.MM.yyyy  i am gone to be crazy. Since 4 Hourse i am trying it to fixt this -_-''

So please help me.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 08 May 2013, 12:17 PM
Hello Oliver,

I tried to reproduce the problem with the server validation on my side but to no avail. I attached my test project. Could you check it and let me know if I am missing something? Also, note that if the picker is used as an editor of Ajax bound Grid or a ListView you should include the Kendo culture file for the corresponding culture and set it with the kendo.culture method as described in this topic. If you are using a form and the client-side jQuery validation is triggered then you should override the validator date method. By default the jQuery validation does not support globalized dates and numbers.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Date/Time Pickers
Asked by
Oliver
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or