How do I find the index of a selected item in a listview control
Posted on 2010-09-15
I'm a little new to this and don't yet fully understand the listview control, but here's what I'm trying to do:
I have a listview control with which I'm using templates (a couple of labels and an image button) in an image gallery. The datapager for the listview has a page size of 15 and there are several pages of items. When a user clicks an image button, I need to determine the index of that selected item within the listview collection so that I may, at some later point, return the listview control to the page that contains that item. For instance, a user clicks an image button (thumbnail image) and the page navigates away to show a full-sized image. When the user returns to the page, I want to reset the listview to the page the user was on before navigating away.
I tried to capture the selected index with:
dim idx as Integer
idx = ListView1.SelectedIndex
However, this returns a value of -1 regardless of the item selected. Please help this dumb guy figure this out. :)