greendisease
greendisease

Reputation: 11

Linking multiple ListBoxes to only allow single select

I have three ListBoxes each representing a single field database table. They are presented side by side on the ASP.NET page. Is there any way to group them so that only a single item from any of the boxes can be selected at a time?

edit - ie, if item 3 in box 1 is selected, selecting any item in box 2 must unselect it

Upvotes: 1

Views: 1798

Answers (1)

Bob Kaufman
Bob Kaufman

Reputation: 12835

I would add an event to each of their SelectedIndexChanged events which resets the index of the other two controls to -1.

More to the point, it sounds like the interface you're creating is a tad awkward, or non-intuitive at the very least. Why are you presenting this as three lists? Do you feel it's going to be necessary to preface these controls with a lengthy explanation? (A UI "smell" to be sure!) Would it make more sense to combine them into one list? Would it make sense to have a set of three radio buttons (e.g., Animal, Vegetable, Mineral) which determine which of the three lists (Animals, Vegetables, Minerals) is displayed?

Upvotes: 3

Related Questions