I have the following code that I am working on in MVC 5 Bootstrap and Razor
@Html.TextBox("Agno", String.Format("{0:d}", DateTime.Now.ToString("yyyy")), new { @class = "form-control", type = "date", @required = "required" })
But it only shows me the control DatePicker
and what I want is just to select the year, Select! not Edit! Can this be done?
I had a similar problem and fixed it by modifying
@readonly = false
. In your case it would look like this:I don't know how you have declared your
datepicker
but if you define in javascript like this:From the beginning it will only select and show the year. Here is the documentation.
I think it's best to do something like this:
you must have find reference all boostrap and jQuery
I hope it helps you