As you know we can set attributes to actionLink or textBox in razor views but how can we set attributes to @Html.EditorFor, I know the EditorFor is a dynamic el
@Html.EditorFor
Add custom attributes as
@Html.EditorFor(model => model.Name, new { htmlAttributes = new { @data_minlength = "3", @class = "form-control input-md", @placeholder = "Name", @required = "required", @id= "txtName"} })
Replace data- to @data_
It will generate correct html with data-