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.
Unfortunately, activation email could not send to your email. Please try again.

Ctrl-end and hidden rows...

Thread ID:

Created:

Updated:

Platform:

Replies:

67977 Sep 5,2007 02:12 PM Sep 6,2007 05:43 PM Windows Forms 1
loading
Tags: GridControl
Philip Bishop
Asked On September 5, 2007 02:12 PM

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.

Rajagopal [Syncfusion]
Replied On September 6, 2007 05:43 PM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;