You've all been doing this for a bit, so please be patient...
Please follow along to see the logic…don't assume the initial error is my issue...
In MVC - I have a part view and wanted a datepicker on it.
So in my _PartialFormName.cshtml I had (from the sample) the following:
<input id="datepicker" />
<script>
$(function() {
$("#datepicker").kendoDatePicker();
});
</script>
This reports the error $ not defined.
That's because the render scripts call hasn't loaded the JQuery library at the bottom of the _Layout.cshtml page:
@Scripts.Render("~/bundles/scripts")
AND the script is not in a @section Script section that will be rendered by the call:
@RenderSection("scripts", required: false)
So, I put the script for datetimepicker it in the @section Script block...
BUT that's in the main MainPage.cshtml razor page, NOT the _PartialFormName.cshtml partial page…
So I need to know and collect all the control scripts of ALL partial views and put their scripts in the containing page?
******************************************
Now the best practice question...
Should I reference a child script named for that partial view containing all of the kendo scritps for that page?
How do we best contain kendo scripts? Is there a best practice?
Thanks
Thanks
R
Please follow along to see the logic…don't assume the initial error is my issue...
In MVC - I have a part view and wanted a datepicker on it.
So in my _PartialFormName.cshtml I had (from the sample) the following:
<input id="datepicker" />
<script>
$(function() {
$("#datepicker").kendoDatePicker();
});
</script>
This reports the error $ not defined.
That's because the render scripts call hasn't loaded the JQuery library at the bottom of the _Layout.cshtml page:
@Scripts.Render("~/bundles/scripts")
AND the script is not in a @section Script section that will be rendered by the call:
@RenderSection("scripts", required: false)
So, I put the script for datetimepicker it in the @section Script block...
BUT that's in the main MainPage.cshtml razor page, NOT the _PartialFormName.cshtml partial page…
So I need to know and collect all the control scripts of ALL partial views and put their scripts in the containing page?
******************************************
Now the best practice question...
Should I reference a child script named for that partial view containing all of the kendo scritps for that page?
How do we best contain kendo scripts? Is there a best practice?
Thanks
Thanks
R