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 some controls.
@Html.EditorFor(m => m.Position, new { @class = "smallinput", style = "width:150px !important" })
@Html.EditorFor(m => m.DocumentType)
In Editor: Views/Shared/DisplayTemplates/Enum.cshtml
@model Enum
@{
   var values = Enum.GetValues(ViewData.ModelMetadata.ModelType).Cast<object>()
                 .Select(v => new SelectListItem
                 {
                     Selected = v.Equals(Model),
                     Text = v.GetDisplayName(),
                     Value = v.ToString()
                 });
}
@Html.DropDownList("", values)
In Model
[DisplayName("نوع سند")]
[UIHint("Enum")]
public DocumentType DocumentType { get; set; }
 
    