I tried this one, but not working
@Html.EditorFor(model => model.discount, new { htmlAttributes = new { @class = "form-control", @type = "number", @step = "0.01", @min = "1", @max = "99999" } })
Use maxlength
and a TextBoxFor
instead of EditorFor
EditorFor
has no overload that permit to do that.
This could be even more interesting for you : maxlength attribute of a text box from the DataAnnotations StringLength in Asp.Net MVC
@minlength="10",@maximumlength="10" u can use textboxfor or editorfor anything will work......