An item is always selected in the dropdownlist control. You cannot deselect
every item in the list at the same time. You can change the selection of the
list though by specifing an index to select (e.g. DropDownList1.SelectedIndex
= 3. If i have misunderstood your question please reply to this post.
If I did a Sql select, for example the alpabet, the first letter "A" is
displayed in the dropdownlist yet I haven't clicked on the dropdown to
select a letter yet. If the dropdown is null, then I could search the whole
alphabet. I want the dropdownlist to display nothing until I click the
dropdown and select a value.
I am not sure if I follow what you are saying. If there are no entries in
the dropdownlist the SelectedIndex will be equal to -1. So are you saying
that when the dropdownlist is in this state (SelectedIndex = -1 [no items in
the list]) and you click on the dropdownlist you want it to bind to the data
at that moment so you can make a selection?
If this is or is not correct please reply so I may understand more clearly
and try to help you.
If I did a Sql select, for example the alpabet, the first letter "A" is
displayed in the dropdownlist yet I haven't clicked on the dropdown to
select a letter yet. If the dropdown is null, then I could search the whole
alphabet. I want the dropdownlist to display nothing until I click the
dropdown and select a value.
Then you need to somehow add a blank as the first row in the binding dataset,
e.g if you use a query/view for dropdown box's data source, you can do like
select '' as your_column_name
UNION ALL SELECT whatever_you _select
This way you get a blank selected as the first row in the dadaset
It's like Muzzy just suggested. I tried Muzzy's idea with the blank being
first and that will work. I'm used to Powerbuilder retrieving the
information but putting a null value in the dropdown until I click the
dropdown button and allowing me to select my options.
It's like Muzzy just suggested. I tried Muzzy's idea with the blank being
first and that will work. I'm used to Powerbuilder retrieving the
information but putting a null value in the dropdown until I click the
dropdown button and allowing me to select my options.
I am not sure if I follow what you are saying. If there are no entries in
the dropdownlist the SelectedIndex will be equal to -1. So are you saying
that when the dropdownlist is in this state (SelectedIndex = -1 [no items
in
the list]) and you click on the dropdownlist you want it to bind to the
data
at that moment so you can make a selection?
If this is or is not correct please reply so I may understand more clearly
and try to help you.
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.