469,632 Members | 1,732 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,632 developers. It's quick & easy.

DropDownList: SelectedIndexChanged and first item in list

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
1 2751
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.

Similar topics

1 post views Thread by Aaron Prohaska | last post: by
2 posts views Thread by Shiju Poyilil | last post: by
11 posts views Thread by Santosh | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.