I have a problem with the initial display of values in datepicker controls :
For example, April 3rd 2015 displays as 03/04/2015, but when opening the datepicker calendar, it has selected March 4th 2015 as date. Manually selecting April 3rd 2015 in the calendar again results in exactly the same display text (03/04/2015)...
Given a model which looks like this:
Configuration in web.config :
Content in _Layout.cshtml
BundleConfig :
Editor template :
cshtml page concerned:
What am I missing here?
For example, April 3rd 2015 displays as 03/04/2015, but when opening the datepicker calendar, it has selected March 4th 2015 as date. Manually selecting April 3rd 2015 in the calendar again results in exactly the same display text (03/04/2015)...
Given a model which looks like this:
[Display(Name =
"Start Date"
)]
[DataType(DataType.Date)]
public
DateTime StartDate {
get
;
set
; }
Configuration in web.config :
<system.web>
<globalization uiCulture=
"en-GB"
culture=
"en-GB"
/>
Content in _Layout.cshtml
<head>
<meta http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta charset=
"utf-8"
/>
<meta name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link rel=
"shortcut icon"
href=
"~/Content/Images/favicon.ico"
type=
"image/x-icon"
/>
<meta name=
"accept-language"
content=
"en-GB"
/>
@Scripts.Render(
"~/bundles/jquery"
)
@Scripts.Render(
"~/bundles/bootstrap"
)
@Scripts.Render(
"~/bundles/kendo/kendoscripts"
)
@RenderSection(
"scripts"
,
false
)
@RenderSection(
"scripts2"
,
false
)
@Scripts.Render(
"~/bundles/Scripts/cultures/en"
)
@Html.Kendo().DeferredScripts()
<script type=
"text/javascript"
>
var baseLocation =
'@(Url.Content("~").TrimEnd('
/
'))'
;
$(document).ready(function () {
var data = $(
"meta[name='accept-language']"
).attr(
"content"
);
kendo.culture(data);
});
</script>
BundleConfig :
bundles.Add(
new
ScriptBundle(
"~/bundles/Scripts/cultures/en"
)
.Include(
"~/Scripts/kendo/cultures/kendo.culture.en-GB.min.js"
)
.Include(
"~/Scripts/cultures/kendo.en-GB.js"
));
Editor template :
@model DateTime?
@(Html.Kendo().DatePickerFor(m => m).Deferred().HtmlAttributes(
new
{ @
class
=
"form-control k-datepicker-label-top"
}))
cshtml page concerned:
<
div
class
=
" col-md-3"
>
<
div
class
=
"form-group"
>
@Html.LabelFor(m => m.StartDate)
@Html.EditorFor(m => m.StartDate)
</
div
>
</
div>
What am I missing here?