Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
Selected Row is changed when grid is refreshed
posted

Is there a way to override the selected row being reset after its datasource is refreshed? I currently have the datasource to the grid set to refresh every 10 seconds, and I notice with this code when I start clicking through the messageboxes eventually they will be empty because the selected row has changed back to the top. I'm using the messagebox to test getting values from the row.

 

    Private Sub dgvUD01_ClickCellButton(ByVal sender As Object, ByVal e As CellEventArgs)
        'Dim rootRow As UltraGridGroupByRow = dgvCNCReview.Rows(0)
        If e.Cell.Column.Key = "make" Then
            For i As Integer = 0 To dgvCNCReview.DisplayLayout.Bands(0).Columns.Count - 1
                If dgvCNCReview.DisplayLayout.Rows(e.Cell.Row.Index).Cells(i).Column.IsVisibleInLayout And (dgvCNCReview.DisplayLayout.Rows(e.Cell.Row.Index).Cells(i).Column.Key <> "make" And _
                 dgvCNCReview.DisplayLayout.Rows(e.Cell.Row.Index).Cells(i).Column.Key <> "buy") Then
                    EpiMessageBox.Show(dgvCNCReview.DisplayLayout.Rows(e.Cell.Row.Index).Cells(i).Text.ToString)
                End If
            Next

        ElseIf e.Cell.Column.Key = "buy" Then
            For i As Integer = 0 To dgvCNCReview.DisplayLayout.Bands(0).Columns.Count - 1
                'Dim _cell As UltraGridCell = dgvCNCReview.DisplayLayout.Rows(e.Cell.Row.Index).Cells(i)
                If dgvCNCReview.DisplayLayout.Rows(e.Cell.Row.Index).Cells(i).Column.IsVisibleInLayout And (dgvCNCReview.DisplayLayout.Rows(e.Cell.Row.Index).Cells(i).Column.Key <> "make" And _
                 dgvCNCReview.DisplayLayout.Rows(e.Cell.Row.Index).Cells(i).Column.Key <> "buy") Then
                    'EpiMessageBox.Show(dgvUD01.DisplayLayout.Bands(aCell.Band.Index).Columns(i).ToString)
                    EpiMessageBox.Show(dgvCNCReview.DisplayLayout.Rows(e.Cell.Row.Index).Cells(i).Text.ToString)
                End If
            Next
        End If
    End Sub

 

Thanks for any help,

 

Ted

 

 

 

Parents Reply Children