If have the following enum
public enum EmployeeType
{
Manager = 1,
TeamLeader,
Senior,
Junior
}
and i have DropDownList and i want to bind this enum to it .. is it any way to do that ?
If have the following enum
public enum EmployeeType
{
Manager = 1,
TeamLeader,
Senior,
Junior
}
and i have DropDownList and i want to bind this enum to it .. is it any way to do that ?
if you have DropDownList object called ddl you can do it as below
ddl.DataSource = Enum.GetNames(typeof(EmployeeType));
ddl.DataBind();
if you want the Enum value Back on Selection ....
EmployeeType empType= (EmployeeType)Enum.Parse(ddl.SelectedValue);