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 do not know how I assign an ID to the field: @Html.EditorFor(model => model.DT_AGENDAMENTO, new { htmlAttributes = new { @class = "form-control" } })
, put ID in <div>
, but when renderizo does not work and also does not give js error.
I tried to install this package, but it gives an error:
PM > Install-Package DatePickerHTMLHelper
EDIT1
In Dev Tools, I got this error. I said there were no errors, but I got this:
GET link 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 did this script
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/jqueryui")
<script type="text/javascript">
$(document).ready(function(){
$(".datepicker").datepicker();
});
</script>
}
It does not work anyway. It does not work by a decree.