I have a model that includes a DateTime field. It has a "[Required]" attribute on the property. My .cshtml file includes this:
I'm not seeing the HTML attributes rendered into the output that I would expect, ex. data-val-required, etc.
I copied over the EditorTemplates from the sample project, then created a clean page to help isolate the problem. Instead of using the above, I tried this:
When this page runs, I see the validation attributes in the HTML as expected, however the JS on the page fails with "Uncaught TypeError: Object [object Object] has no method 'kendoDateTimePicker' "
I thought it might be because I have all of my JS references at the bottom of the page (to speed up page rendering), so I tested them at the top - I get the same error.
So the big question is - how do I make this work? More specifically, how do I make this work without just hardcoding the attributes in via the HtmlAttributes() method?
@(Html.Kendo()
.DatePickerFor(p => p.CashReceipt.ReceivedOn)
.HtmlAttributes(new { type = "text" })
)
I'm not seeing the HTML attributes rendered into the output that I would expect, ex. data-val-required, etc.
I copied over the EditorTemplates from the sample project, then created a clean page to help isolate the problem. Instead of using the above, I tried this:
@Html.EditorFor(p => p.CashReceipt.ReceivedOn)
When this page runs, I see the validation attributes in the HTML as expected, however the JS on the page fails with "Uncaught TypeError: Object [object Object] has no method 'kendoDateTimePicker' "
I thought it might be because I have all of my JS references at the bottom of the page (to speed up page rendering), so I tested them at the top - I get the same error.
<
script
src
=
"http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"
type
=
"text/javascript"
></
script
>
<
script
type
=
"text/javascript"
src
=
"/Scripts/modernizr-1.7.min.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"/Scripts/jquery.validate.min.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"/Scripts/jquery.validate.unobtrusive.min.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"/Scripts/knockout-2.0.0.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"/Scripts/kendo.web.min.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"/Scripts/kendo.aspnetmvc.min.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"/Scripts/knockout-kendo.min.js"
></
script
>
So the big question is - how do I make this work? More specifically, how do I make this work without just hardcoding the attributes in via the HtmlAttributes() method?