We can Bind DropDownList with no of ways, Now I am going to show how to bind dropdown
using ‘enum’.
Check This How To Bind DropDownList Using List Collection and DataSet in Asp.Net
Let’s take Countries ‘enum’ as follows
Read More»
Check This How To Bind DropDownList Using List Collection and DataSet in Asp.Net
Let’s take Countries ‘enum’ as follows
enum enCountries:int{India =0,USA ,UK ,UAE};
Let see How to Bind the DropDownList With Enum
ddlEnumBind.Items.Add("--Select
Country--");
//get enum items to get the respective enum value
string[]
enumNames=Enum.GetNames(typeof(enCountries));
foreach (string item in enumNames)
{
//get the enum
item value
int
value = (int)Enum.Parse(typeof(enCountries),
item);
ListItem
listItem = new ListItem(item,
value.ToString());
ddlEnumBind.Items.Add(listItem);
}
Posts






















