I want to configure datepicker in my MVC 5 form. I have included all the reference libraries like Jquery, datepicker etc.
Following is the line from MVC razor view, which is created by Visual Studio in a result for MVC 5 scaffolding.
@Html.EditorFor(model => model.News_Date, new { htmlAttributes = new { @class = "form-control" }})
any help in this regard
Just add the id property to the html-attributes. That will override the default id generated by the editorfor-helper-methode.
Look at this post: How can I set id using Html.EditorFor with MVC3
@Html.EditorFor(model => model.News_Date, new { htmlAttributes = new { @class = "form-control", id = "my_custom_id" }})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With