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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

drop list question 2
Excel Excel: How do I put a formula in a drop down list 11
Drop Down List, AutoPostBack 1
Multiple Drop-Downs 3
Multiple DropDownLists 7
drop down selected index 9
Drop Down List 2
Drop Down List User Control 1

Back
Top