How can I add html attributes such as maxlength, style, css and ... to Html.EditorFor()?
This is way late but maybe someone else will find this helpful.
Why walk the long way? I suppose we are dealing with a string since you want to add a maxlength attribute. Then you can just use Html.TextBoxFor instead of Html.Editorfor.
TextBoxFor accepts html attributes.
@Html.TextBoxFor(model => model.Name, new{ maxlength = 50 })