DropDownList

  • Thread starter Thread starter Chris Scragg
  • Start date Start date
C

Chris Scragg

On a form, I have a dopdownlist with 5 values assigned to items (list). Im
using a postback method that in turns repopulates the dropdownlist.
However, when I populate the list with the new values, the old values are
still there along with the new values (the list is huge!).

How can I easily reinitialize the dropdownlist between postbacks so the list
only has the new items in it?

Chris
 
I have to assume you mean a combo box.

so heres what you do...

this.comboBox1.Items.Clear();
 
He means DropDownList, he's using a WebForm..


System.Web.UI.WebControls.DropDownList



have you tried

DropDownList.Items.Clear();

not sure if that does the trick

otherwise you'd probably have to do the lame

DropDownList.Items.RemoveAt(0);

about 5 times on each post back,
then repopulate it..
 
Back
Top