Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 16, 2010 03:14 PM by chandrasoma123
Sep 09, 2008 08:26 PM|LINK
It didn't have anything to do with binding to an objectdatasource rather than in code. I tried binding to an object datasource and I still get the same results - the event does not fire. There are four other dropdownlists within this modalpopup window. Two
of them work as expected (the top two) and the three on the bottom exhibit the same behavior as the dropdownlist in question (the SelectedIndexChanged event does not fire). Another strange thing is that when I change the value of one of the dropdown lists on
the top that works as expected (state for example) the SelectedIndexChanged event does fire for that dropdown list and THEN the SelectedIndexChanged event fires for the dropdownlist in question, even though the value did not change.
This is so strange, I just am not getting it... I even tried dragging one of the dropdowns that wasn't working to the top of the page thinking there might be an error somewhere inbetween the ones that worked and the ones that didn't but no luck, still the
Sep 09, 2008 09:30 PM|LINK
So it is only working correctly for the dropdownlists that have a hard-coded listitem. If I set appendDataBoundItems=true and insert a listitem, the SelectedIndexChanged event does fire when it is supposed to.
So now I have to hardcode a listitem and then remove it programmatically and it works as expected without the extra listitem. What a hacky way to get a control to work as it should...
Sep 09, 2008 10:02 PM|LINK
SelectedIndexChanged event will ONLY fire once the Index of the ListItem is changed.Like for instance if you the default Selected items in the list is the ListItem1 and when you select ListItem1 on the DLL again then SelectedIndex changed will NEVER fire
because the index is not changed yet.. It will only fire once you select ListItem 2 or any items on the DDL except for the current selected item.
Sep 10, 2008 01:55 PM|LINK
Yes that is true and the values have to be unique. This doesn't have anything to do with the "bug" that I found though. Thanks for taking the time to respond though.
Sep 17, 2008 06:23 PM|LINK
Did you ever find a solution to this. This same thing is happening to me now.
Oct 03, 2008 03:18 PM|LINK
My "solution" was to hard-code a list item and then remove it in code. If there was a hard-coded list item it worked as expected but not if it was just bound to a datasource.
Oct 17, 2008 03:39 PM|LINK
I had the same issue. What I discovered was that a containing control had its view state disabled.
In my specific case, I had a table row, running server side, so that I could hide the row. Viewstate for the table row was disabled. This also disabled viewstate for the drop down list in that row. I recognized the issue while debugging because the drop
down list control was missing all its values on postback of the page, leading me to believe there was a viewstate issue.
When I enabled viewstate for the table row, the drop down list in that table row worked fine.
Is this a bug in asp.net or is this "as designed"?
Mar 30, 2010 07:04 AM|LINK
Hi guys for me it was a problem of ViewState.
i solved the same by setting: EnableViewState="true" in page directive and form. check yours.
May 18, 2010 04:14 AM|LINK
What I did to fix this issue was "realize" something silly! On the DropDown1_Load event I set Dropdown1.SelectedIndex = 200. This is WRONG. Instead of doing it from the DropDown1_Load event....I put it under the DropDown1_PreRender event......it worked!!!!
Hope fully this helps someone :)
Jun 15, 2010 05:04 PM|LINK
I just spent about two hours working on this same problem...
What I found was when the listitems were generated through a loop in the codebehind file and I didn't explicitly set one to SELECTED, the SelectedIndexChanged event never fires.
When I add a default value (either through the markup or in the codebehind), this works fine. I wouldn't expect this kind of behavior - I assumed (until now) index 0 would be the default if no option was selected...
drop down dropdownlist autopostback