I want to show Enum in EditorFor. I use Editor Template for show it.(DropDownList).
I have malty EditorFor in view. I want to set class for
You can pass the class name to the EditorTemplate using AdditionalViewData.
In the main view
@Html.EditorFor(m => m.DocumentType, new { htmlAttributes = new { @class = "myclass" } })
and in the EditorTemplate
....
@Html.DropDownListFor(m => m, values, ViewData["htmlAttributes"])
However including the logic for the SelectList in an EditorTemplate is not good practice. I would recommend your consider creating an extension method for generating the SelectList and then this EditorTemplate wont be required. Refer this example. And Selected = v.Equals(Model), is pointless because the Selected property will be ignored (the selected item will be the value of DocumentType)