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

DropDownList: SelectedIndexChanged and first item in list

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


P: n/a
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.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Timo" <ti**@noneofyer.biz> wrote in message
news:MP************************@msnews.microsoft.c om...
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

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.