c# - Kendo Data Picker format Doesnot Work -
hi using mvc kendo ui want change culture en-gb used link
http://docs.telerik.com/kendo-ui/aspnet-mvc/globalization
to change culture , that's works fine for
the grid not date time picker
i used format method , parse format , still not work
try following
1- editortemplate date.cshtml
@model datetime? @(html.kendo() .datepickerfor(m => m) .htmlattributes(new { tabindex = viewdata["tabindex"] }) .format("dd mmm yyyy") .parseformats(new string[]{"yyyy-mm-dd"}) )
2- in global.asax
protected void application_beginrequest(object sender, eventargs e) { cultureinfo info = new cultureinfo("en-gb"); info.datetimeformat.shortdatepattern = "dd mmm yyyy"; info.datetimeformat.longdatepattern = "dd mmm yyyy hh:mm"; info.numberformat.numberdecimaldigits = 2; thread.currentthread.currentculture = info; thread.currentthread.currentuiculture = info; }
3- in _layout.cshtml
<script> kendo.culture("en-gb"); var culture = kendo.culture(); culture.calendar.patterns.d = "dd mmm yyyy"; culture.calendar.patterns.d = "dd mmm yyyy"; culture.calendar.patterns.t = "hh:mm"; culture.calendar.patterns.t = "hh:mm"; culture.calendar.patterns.g = "dd mmm yyyy hh:mm"; culture.calendar.patterns.g = "dd mmm yyyy hh:mm"; </script>
5- make sure added javascript file culture required
hope you
Comments
Post a Comment