How to Add default selection for DropDownList in ASP.net.?

Naveenhcl
Posted by Naveenhcl under ASP.NET category on | Points: 40 | Views : 467
In this code section I just explain how to add default selection for DropDown.

Using below code snippet we can achieve this.

ds = //data;
ddlType.DataSource = ds;
ddlType.DataTextField = "NAME";
ddlType.DataValueField = "ID";
ddlType.DataBind();
ddlType.Items.Insert(0, new ListItem("--Select--", "0"));

Comments or Responses

Login to post response