Reputation: 129
I need to use the required attribute, so the field shoud not be empty
<input type="text" class="form-control" id="inputName" required>
in the razor view, more specifically in this example
@Html.EditorFor(model => model.exclure.libelle, new { htmlAttributes = new { @class = "form-control" } })
Upvotes: 1
Views: 2208
Reputation: 62498
You can specify in htmlAttributes
with TextBoxFor()
this way:
@Html.TextBoxFor(m=>m.exclure.libelle,new{ @class = "form-control",required="required" })
Upvotes: 2