model view controller - Kendo Datepicker Validation Failed for different browser and PC -
i create page has datepicker dd/mm/yyyy format culture ar-sa when try set date it's returns invalid date here datepicker
@(html.kendo().datepickerfor(model => model.reviewdate) .name("reviewdate") .format("dd/mm/yyyy") )
the validation failed on form submit in system. have set culture js document ready kendo.culture("en-gb");
my model is:
[datatype(datatype.date)] [datamember(name = "reviewdate")] [allowhtml] [displayname("review date")] [displayformat(dataformatstring = "{0:dd/mm/yyyy}", applyformatineditmode = true)] public datetime reviewdate { get; set; }
you need set culture , update validator satisfy client-side validation
$(document).ready(function () { kendo.culture("en-gb"); $.validator.addmethod('date', function (value, element) { return this.optional(element) || kendo.parsedate(value) }); });
also set server culture it's same adding following web.config under <system.web>
<globalization uiculture="en-gb" culture="en-gb" enableclientbasedculture="true" ></globalization>
i've used en-gb
can swap out other cultures e.g. ar-sa
if want use instead
Comments
Post a Comment