Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Trupti Patil   on Oct 24 In Asp.net Category.

  
Question Answered By: Eddie Austin   on Oct 24

You could do this after the DropDownList is populated with your data:


//if there is one selected set it to false
DropDownList1.SelectedItem.Selected = false;
//create a new ListItem
ListItem li = new ListItem("Select One","Select One");
//let it be selected
li.Selected = true;
//check if there is allready the ListItem that we wish to be in Collection
if (!DropDownList1.Items.Contains(li))
{
//and if not insert it to the first position
DropDownList1.Items.Insert(0,li);
}

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on DropDown list Or get search suggestion and latest updates.


Tagged: