We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Ctrl-end and hidden rows...

We are working on an app now that has hidden rows for various reasons. Normally when you hit ctrl-end, it will take you to the last row/col in the grid. So if your have 99 rows and 128 cols then the ctrl-end would put you in 99,128. If I only show 32 rows and hide the rest then when I hit ctrl-end it takes me below row 32 and highlights just what appears to be the border bottom of row 32. What I think it is doing is really going to row 99, but since it is hidden it is confused on what to do. Is this how it is suppose to work? I have a sample if needed.

1 Reply

RA Rajagopal Syncfusion Team September 6, 2007 09:43 PM UTC

Hi Philip,

This behavior can be avoided by handling the MoveCurrentCellDirection event of the GridControl. In the event handler, check the Direction when the ctr+end is pressed and accordingly move the currentcell to the lastvisiblerow row. Please try the below code.

Private Function GetLastVisibleRow(ByVal grid As GridControl) As Integer
Dim lastRow As Integer = -1
For row As Integer = grid.RowCount To 1 Step -1
If (Not grid.Rows.Hidden(row)) Then
lastRow = row
Exit For
End If
Next row
Return lastRow
End Function

Private Sub gridControl1_MoveCurrentCellDirection(ByVal sender As Object, ByVal e As GridMoveCurrentCellDirectionEventArgs)
If e.Direction = GridDirectionType.BottomRight Then ' ctrl + End
e.Result = False
e.Handled = True
Dim lastVisibleRow As Integer = GetLastVisibleRow(gridControl1)
Me.gridControl1.CurrentCell.MoveTo(lastVisibleRow, gridControl1.ColCount, GridSetCurrentCellOptions.ScrollInView)
End If
End Sub

Let me know if this helps.

Regards,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon