Clearing a dropdownlist in the code behind

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone help me with the syntax for clearing (removing) all items out of
an asp:dropdownlist from the code behind? Is there a clear method?
 
Hi,

Try the clear method of the items collection.

DropDownList1.Items.Clear();

Hope this helps.
 
PK9 said:
Can someone help me with the syntax for clearing (removing) all items out
of
an asp:dropdownlist from the code behind? Is there a clear method?

The Items property has a collection of the items. You can clear it, add or
remove items.

John Saunders
 
Back
Top