Annoying drop down list...

  • Thread starter Thread starter Paul M
  • Start date Start date
P

Paul M

Hi folks,

When I set the datasource of a dropdown list and bind it, the drop down list
always defaults to the first item in the list. I need it to default to
Nothing or NULL or whatever it is now in .NET.

The situation I've got is a group of combo boxes that interelate. So if you
select item 1 from drop down A, you are prompted to select an item in drop
down B and if you select item 2 from drop down A you are prompted to select
an item from drop down C. At the moment my web page is putting a value in
all three drop downs, when it should only ever be two.

Thanks in advance...

Paul
 
After you call .DataBind on the dropdownlist, you can add the following to
add a blank item at the beginning, that will be selected

DropDownList1.Items.Insert(0, "")
DropDownList1.Items(0).Selected = True

--Michael
 
Back
Top