To load data in dropdownlist

Hi,

Using the following code, you can load the data in dropdownlist and make the desired value selected in the dropdown list while loading.

clientDropDownList.DataSource = client;
clientDropDownList.DataTextField = "ClientName";
clientDropDownList.DataValueField = "ClientID";
clientDropDownList.Items.Insert(0, new ListItem("select", "0"));
clientDropDownList.DataBind();
clientDropDownList.Items.FindByText(clientList.ClientName).Selected = true;

Comments