Problems with Multiple ListBoxes and SelectedIndexChanged
I have a layout with master pages and at the top some ListBoxes that all have autopostback = true and corresponding SelectedIndexChanged events on them.
For some reason when one listbox changed all the events fired in a set order, I haven’t figured out how to stop that from happening, basically they fired from left to right, so when the one on the right changed, listbox 1 fired first, causing unwanted results. I have no idea how to stop that but figured out a way to handle it.
In each SelectedIndexChanged event add this wrapper code:
//ListBox name is ViewList
Boolean isSource = false;
string caller= Page.Request.Params.Get(”__EVENTTARGET”);
Control control = null;
if (caller!= null && caller!= string.Empty)
{
control = Page.FindControl(caller);
if (control.ID == ViewList.ID)
{
isSource = true;
}
}
if (isSource)
{
//perform normal actions here.
}

