How to Add default selection for DropDownList in

Posted by Naveenhcl under ASP.NET category on | Points: 40 | Views : 425
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.Items.Insert(0, new ListItem("--Select--", "0"));

Comments or Responses

Login to post response