Consider the following:
dim dropdownlist1 as new dropdownlist
dim dropdownlist2 as new dropdownlist
dim dropdownlist3 as new dropdownlist
dropdownlist1.AutoPostBack = true
dropdownlist2.AutoPostBack = true
dropdownlist3.AutoPostBack = true
AddHandler dropdownlist1.SelectedIndexChanged, AddressOf SomeEvent
AddHandler dropdownlist2.SelectedIndexChanged, AddressOf SomeEvent
AddHandler dropdownlist3.SelectedIndexChanged, AddressOf SomeEvent
Edit: I want an event to fire no matter which dropdown is selected. Edit:
The SomeEvent fires as expected when any of the dropdown's selection is changed. However if say DropdownList2 has a selection made then I make a selection with either DropDownList1 or DropdownList3, then SomeEvent fires again. What is causing this behavior and how do I get just a single raising of that event?
I suspect that when the viewstate for the dynamcially created dropdownlists is restored and the selection restored, then the event is fired because technically the selected index did change when the control was recreated. The reason I suspect this is that the event fires the for each dropdownlist...