i have an asp.net-mvc webpage and i want to show a dropdown list that is based off an enum. I want to show the text of each enum item and the id being the int value that the en
I did this using a static method that I could reuse.
public static IEnumerable EnumToSelectList()
{
return (Enum.GetValues(typeof(T)).Cast().Select(
e => new SelectListItem() { Text = e.ToString(), Value = e.ToString() })).ToList();
}