I have my text box of type int in my view, it comes out like this with the up and down arrows, how do I declare it so that it doesn't appear like that, or how can I put a dropndownlist with the years there.
<div class="editor-label">
@Html.LabelFor(model => model.Gestion, "Gestión")
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Gestion)
@Html.ValidationMessageFor(model => model.Gestion)
</div>
The default editor for a type property
int
is ainput
numeric type.How it is displayed (with or without arrows) is a matter of the browser.
If you want to use a different editor you must expressly indicate it. For example, if, as you mentioned, you want to make a dropdown to select a year, you could do something like this:
This would display a dropdown with 100 values starting at 1950.