Listbox TopIndex property

fouzwerg

Member
Joined
Feb 24, 2006
Messages
6
Programming Experience
3-5
Hi,

I'm using ASP.NET 2.0 and was wondering what happened with the TopIndex property for the Listbox class that sets the index of the first visible item in the ListBox. Is it no longer a property as it does not appear in the list of properties and methods in Visual Studios and has a compilation error if i include it in the code.

Is there an alternative method of making an item in the list the first visible item in a listbox after a postback?

Thanks.
 
set the ListBox.SelectedIndex
 
The thing is, when a user selects items in the listbox (its set with selectionmode = "multiple") it does a postback in the selectedIndexChanged handler to do some calculations. After the postback the listbox view is set to the top of the list instead of showing the selected item.

So i am not setting the selectedindex as it is already set to the desired result however the listbox is not displaying the selected items.

I wanted to manually set the listbox's topindex property however this property is no longer part of ASP 2.0. How do I get around this?
 
I can't seem to find any reference of TopIndex property for any other controls than the Windows.Forms.ListBox, but that's really irrelevant - the issue is how to make the ASP.Net Listbox scroll to first selected of multiple after a Postback. I found some Javascript for this using the SelectedIndex but didn't get the desired effect, so I have research some more.. :)

Still a bit curious, if you could enlighten me, where in the web world you found this TopIndex property before... ?
 
there are both web forms and windows forms listbox, but they are different
 
Back
Top