By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,855 Members | 865 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,855 IT Pros & Developers. It's quick & easy.

Annoying drop down list...

P: n/a

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
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
"Paul M" <ma****@trials.bham.ac.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...

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

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.