Thursday, May 21, 2015

How to add a default “Select” option to this ASP.NET DropDownList control?

Status status = new Status();
DropDownList1.DataSource = status.getData();
DropDownList1.DataValueField = "ID";
DropDownList1.DataTextField = "Description";
DropDownList1.DataBind();

// Then add your first item
DropDownList1.Items.Insert(0, "Select");

No comments:

Post a Comment