asp.net mvc - How to add custom data attributes and classes to `@Html.EditorFor`? -


i want add custom attributes input generated @html.editorfor, tried following:

@html.editorfor(model => model.percent, new { @class = "percent" }) 

but ignores class, can tell searching around template doesn't support adding custom attributes.

but how 1 create custom template adding support custom attributes, while keeping functionality of old template?

please see following posts, question has been asked before on stackoverflow.

there many more examples, google it.

i hope helps.


Comments