Set DropDownList to nothing (blank)

  • Thread starter Thread starter Greg
  • Start date Start date
G

Greg

I'm trying to set a asp:DropDownList control value to blank/null for records
that have no value. But, I'm finding that even though their is no value in my
source data, it displays a record from the drop down list anyways. How can I
have the DropDownList showing nothing when no value exists?

this.lstManagerID.Text = string.empty;
this.lstManagerID.SelectItemValue = string.empty;
this.ManagerID.SelectedItem.Value = string.Empty;

None of these options set the DropDownList to show nothing.

Any suggestions?

Thx
 
Try this:

this.lstManagerID.Items.Clear();

There is also a Remove() method, but that is obviously only used for
removing one ListItem at a time. The code that you included in your posting
simply changes the Text or Value property of the currently selected
ListItem, but the ListItem still exists in the DropDownList. Good Luck!
 
Back
Top