It is possible to provide a class or other information through AdditionalViewData - I use this where I'm allowing a user to create a form based on database fields (propertyName, editorType, and editorClass).
Based on your initial example:
@Html.EditorFor(x => x.Created, new { cssClass = "date" })
You could also do it via jQuery:
One Best way to apply class to
@Html.EditorFor()
in MVC3 RAzor isIt will add above style to your
EditorFor()
It works for MVC3.
It is possible to provide a class or other information through AdditionalViewData - I use this where I'm allowing a user to create a form based on database fields (propertyName, editorType, and editorClass).
Based on your initial example:
and in the custom template:
Using jQuery, you can do it easily:
Here is your input tag
For DropDownlist you can use this one:
For Dropdownlist: