Topic: Dropdownlist binding with webform
Share/Save/Bookmark
C# DROPDOWN LIST
 
To display items from a data set in a ListBox, DropDownList, CheckBoxList, or RadioButtonList control, follow these steps:
 
1. Set the control's "DataSource" property to the name of the data set.
2. Set the control's "DataText" property to the data set member to display as "Text" property of the list item.
3. Set the control's "DataValue" property to the data set member to return as the "Value" property of the list item.
4. In code, fill the data set from data adapter and bind to the control.
 
// Fill the dataset
da_Whatever.Fill(ds_Whatever);
// Bind the data
control_Whatever.DataBind();