I have a asp:ListBox wrapped inside an asp:UpdatePanel. The list box contains all the United States. If I select Alaska, for example, and then scroll down to select Wyoming, the listbox jumps back up to the top of the list instead of staying on Wyoming and it deselects Alaska, but Wyoming remains selected. Has anyone ran into this before?
views:
330answers:
1
+1
A:
It sounds like you have the listbox set to autopostback. This would explain the jumping as the page or partial page (inside your Update Panel) gets reloaded.
As to deselecting the default choice (Alaska), this is default behavior. Only 1 option can be selected by clicking (even if you have SelectionMode set to multiple). To select multiple options, if enabled, you need to Ctrl-Click the options. This is browser/OS behavior you don't control directly.
HectorMac
2008-12-10 18:32:02
You are correct, but in order for my listbox to generate the selected_index changed event, I need to enable autopostback.
Xaisoft
2008-12-10 18:59:58
Well then you get what you have there. The UpdatePanel is no panacea. Sometimes you actually have to do some work.
Robert C. Barth
2008-12-10 21:35:13
Thanks for that helpful comment.
Xaisoft
2008-12-11 15:00:31