.Net, Tips & Tricks, Web

Tips to Bind Dropdownlist in Asp.net

Tips to Bind Dropdownlist in Asp.net

We can bind DropDownList in different ways by using List, Dictionary, Enum and DataSet.

To bind DropDownList, we need to set some properties:


Let’s see how to use these properties to bind DropDownList.

Binding DropDownList with List

In this case, the DropDownList both ‘Value’ and ‘Text’ field are same.

Binding DropDownList with Dictionary

Binding DropDownList with DataSet

My DataSet contains a Class table(class_id,class_name,description).

Let’s take Countries ‘enum’ as follows:

enum enCountries:int{India=0,USA,UK,UAE};
Let’s see how to bind the DropDownList With Enum: