How to bind the enum to dropdown list

Saratvaddilli
Posted by Saratvaddilli under C# category on | Points: 40 | Views : 1582
We can bind the enum to droplist:
Let us assume that our enum was in someother project , now just add the dll and in the code behind do like this

if (!IsPostBack)
{
ddlType.DataSource = Enum.GetNames(typeof(SecurityType));
ddlType.DataBind();
ddlAlgorithm.DataSource = Enum.GetNames(typeof(ServiceProvider));
ddAlgorithm.DataBind();

}

Comments or Responses

Login to post response