If Session("pks") IsNot Nothing Then
Dim selectedPKs As List(Of Object) =
CType(Session("pks"), List(Of Object))
For i As Integer = 0 To selectedPKs.Count - 1
Dim selectedIdx As Integer = ASPxGridView1.
FindVisibleIndexByKeyValue(selectedPKs(i))
If selectedIdx >= ASPxGridView1.VisibleStartIndex And
selectedIdx <= ASPxGridView1.VisibleStartIndex +
ASPxGridView1.VisibleRowCount Then
ASPxGridView1.FocusedRowIndex = selectedIdx
Exit For
End If
Next i
End If
This snippet goes in the Data_Bound event so that it executes each time the user moves to a different page within the grid view.
3 comments:
Hi Todd,
Thanks for the snippet, however, the multiple selection should remember the selected rows even between pages. Check out this demo: http://bit.ly/d2pRAL
@mharrydx thanks for the response! I guess I should've been more clear in my description...this snippet will set the focused row to the first selected row it encounters on a page. If this snippet isn't present (and you aren't using checkboxes in your grid) then the focused row defaults to the first row on the page and, in my situation, that caused some confusion for the user.
After seeing the demo I'm going to give the checkbox approach another look.
I'll make an edit to clarify.
Hi Todd,
Ah, I get you now. You might want to submit a suggestion to the support center as well. Thanks!
Post a Comment