If I have the following enum
public enum EmployeeType
{
Manager = 1,
TeamLeader,
Senior,
Junior
}
and I have DropDownList
Here is another approach:
Array itemNames = System.Enum.GetNames(typeof(EmployeeType));
foreach (String name in itemNames)
{
//get the enum item value
Int32 value = (Int32)Enum.Parse(typeof(EmployeeType), name);
ListItem listItem = new ListItem(name, value.ToString());
ddlEnumBind.Items.Add(listItem);
}
i used this link to do it:
http://www.codeproject.com/Tips/303564/Binding-DropDownList-Using-List-Collection-Enum-an