December 30th, 2004, 10:17 AM
Scroll selected item to top in ListBox control
I have a multiple select list box control on an aspx page controlled by VB code. I only have enough real estate to show 5 items in the list at any one time, therefore, the list box contains more items than will show at any one time. When an items is selected, the OnSelectedIndexChanged event is fired which gathers the selected items for later processing and the aspx is refreshed. This all works fine with the following problem, the refresh of the aspx always shows the very top portion of the list in the list box control regardless of which items are selected. How do I force it to automatically scroll down to the first selected item in the list if this item is not in the topmost portion of the list? In PowerBuilder, I would just do a ScrollToTop and supply it with the index of the item I wanted it to scroll to. I cannot find any way to do that with VB. Any help would be greatly appreciated. Thanks in advance for your help.
December 30th, 2004, 11:45 PM
you can do list1.topindex=somevalue in vb6. i'm not sure about vbscript.