DropDownList: SelectedIndexChanged and first item in list

T

Timo

I am trying to use the DropDownList_SelectedIndexChanged event on
a dropdown which is dynamically populated with different values at
runtime, depending on what the user has been doing. The dropdown
works and the event fires except when the user selects the *first*
item in the list, which appears to be the default selection, even
though the generated HTML code does not have a "selected" property
set.

Is it possible to cause the index-changed event to fire when the
user picks the first item in the list? That is, without resorting
to a kludge, such as inserting a bogus "Please select an item" or
a blank item?
Thanks
Timo
 
A

Alvin Bruney [MVP]

The selectedindexchanged event fires only when the index has changed. If
your initial selection doesn't change, the event doesn't fire. You will need
to put a place holder - select an option - in there or take the long,
unpleasant way around by writing customized javascript to manually fire the
event.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top