I have an int value that I want to render as a numeric up down with an id that is"Quantity" , so I do the following in razor:
<div class="field-label">@Html.LabelFor(m => model.Quantity)</div>
<div class="field-editor">@Html.EditorFor(m => model.Quantity, null, "Quantity")</div>
In chrome this gives me the right UI, however I would like to set the min, max and default value so it works like the following code does.
<input id="Quantity" type="number" name="quantity" min="0" max="10" value="0" >
You can do this via the "object AddiditonalViewData" overload of the @Html.EditorFor function. Then specify htmlAttributes like so:
Note that the "value" is set to the actual value of the Quantity property, no matter what you define in the htmlAttributes.