0
I have this Razor in my view:
<div class="form-group">
@*@Html.LabelFor(model => model.DT_AGENDAMENTO, htmlAttributes: new { @class = "control-label col-md-2" })*@
@Html.Label("Data de Agendamento", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10" id="datepicker">
@Html.EditorFor(model => model.DT_AGENDAMENTO, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DT_AGENDAMENTO, "", new { @class = "text-danger" })
</div>
</div>
And at the bottom of the page I have these scripts:
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/jqueryui")
$(".datepicker").datepicker();
}
I don’t know how I assign an ID to the field: @Html.EditorFor(model => model.DT_AGENDAMENTO, new { htmlAttributes = new { @class = "form-control" } })
, I put the ID on <div>
, but when Address does not work and also does not give js error.
I tried to install this package but gives error:
PM> Install-Package Datepickerhtmlhelper
EDIT1
In Dev Tools, I got this bug. I said there were no mistakes, but I got this:
GET http://localhost:55839/Bundles/jqueryui 404 (Not Found)
EDIT2
I created a class called datepicker like this:
@Html.EditorFor(model => model.DT_AGENDAMENTO, new { htmlAttributes = new { @class = "form-control datepicker"
And I wrote this script
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/jqueryui")
<script type="text/javascript">
$(document).ready(function(){
$(".datepicker").datepicker();
});
</script>
}
Anyway it doesn’t work. Not funnel nor by a decree.
I believe you did not register the Bundles page, usually this is done at the event
Application_Start
in the archiveGlobal.asax
making some call involving theBundleTable.Bundles
.– Tobias Mesquita