Partial Class Grid_Selection_OnRowSelection_OneRowSelectionVB
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
ClearSelectionOnOtherPages()
End Sub
Private Sub ClearSelectionOnOtherPages()
If grid.Selection.Count <= 1 Then
Return
End If
Dim curPageSelection As Integer = GetSelectedRowOnTheCurrentPage()
grid.Selection.UnselectAll()
grid.Selection.SelectRow(curPageSelection)
End Sub
Private Function GetSelectedRowOnTheCurrentPage() As Integer
Dim startIndexOnPage As Integer = grid.PageIndex * grid.SettingsPager.PageSize
For i As Integer = 0 To grid.VisibleRowCount - 1
If grid.Selection.IsRowSelected(startIndexOnPage + i) Then
Return startIndexOnPage + i
End If
Next
Return -1
End Function
Public Overridable Function GetFieldChecked(ByVal item As Object) As String
If Session("FocusedRow") IsNot Nothing Then Dim row As DevExpress.Web.Data.WebDescriptorRowBase = TryCast(item, DevExpress.Web.Data.WebDescriptorRowBase)
Dim o As Object = grid.GetRowValues(row.VisibleIndex, grid.KeyFieldName)
Return IIf(Session("FocusedRow").ToString().Trim() = o.ToString().Trim(), "CHECKED", "") Else
Return ""
End If
End Function
Protected Sub grid_CustomCallback(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs)
Session("FocusedRow") = grid.GetRowValues(Convert.ToInt32(e.Parameters), New String() {grid.KeyFieldName}) End Sub
End Class
Thanks.