I\'m trying to add a class to an input.
This is not working:
@Html.EditorFor(x => x.Created, new { @class = \"date\" })
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" })
and in the custom template:
@Html.TextBoxFor(x => x.Created, new { @class = ViewData["cssClass"] })