I have an aspx page with 5 listboxes. Each listbox can filter the other one, so if the user selects an item in listbox 1, listbox 2, 3, 4, and 5 should be filtered. If the user selects an item in listbox 3, listbox 1, 2, 4, and 5 should be filtered. The filter can go forward and backward. Another scenario would be where I select an item in listbox 1, it filters the others and then I select an item in listbox 2 and it further filters listbox 1 and the others, like a chain effect. I also have to handle multiple selections as well. This can get very messy and I am curious as to if anyone knows a good way to handle this.
Share
In my experience with issues like this sometimes the easiest approach is to build everything dynamically in code behind.
You start with ListBox 1 on your page and disable/hide the others as appropriate. Then you handle the ItemSelected event on ListBox 1 and add the appropriate items to ListBox 2 and enable/unhide it. And then handle the Item Selected Event on ListBox 2 in a similar matter cascading updates down your page/control.
If necessary you can wrap the list boxes in an update panel so the refreshes do not impact other controls on the page.
Pseudo Code:
code behind: