1

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" } })
Anjaly
  • 11
  • 2

2 Answers2

1

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

Ende
  • 303
  • 2
  • 4
  • 24
1

@minlength="10",@maximumlength="10" u can use textboxfor or editorfor anything will work......