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

GridDirectionType confusion

I''m trying to work around disabled cells in my grid. However, I''ve run into a problem when I''m in the last column of a row, and the cell in the next row (last column) is disabled. In the QueryNextCurrentCellPosition, instead of the GridDirectionType.Right that I expect to get, I get Down. (Sample attached). As a result, the next cell jumps a row. Does anyone have any suggestions how I can detect this situation and hence fix the movement? Thanks, Sue forum_wrapping1_4128.zip

1 Reply

AD Administrator Syncfusion Team April 19, 2004 11:08 PM

Hi Sue, you can use the MoveCurrentCellDirection event instead: private void gridControl1_MoveCurrentCellDirection(object sender, GridMoveCurrentCellDirectionEventArgs e) { GridControlBase grid = sender as GridControlBase; GridModel gridModel = grid.Model; int row = e.RowIndex; int col = e.ColIndex; switch (e.Direction) { case GridDirectionType.Right: { col++; if (col > gridModel.ColCount) { row++; col = grid.LeftColIndex; } while (row < gridModel.RowCount) { using (GridStyleInfo style = grid.GetViewStyleInfo(row, col)) { if (style.Enabled) { e.Result = grid.CurrentCell.MoveTo(row, col); e.Handled = true; return; } col++; if (col > gridModel.ColCount) { row++; col = grid.LeftColIndex; } } } e.Handled = true; e.Result = false; break; } case GridDirectionType.Left: { col--; if (col == gridModel.Cols.HeaderCount) { row--; col = gridModel.ColCount; } while (row > gridModel.Rows.HeaderCount) { using (GridStyleInfo style = grid.GetViewStyleInfo(row, col)) { if (style.Enabled) { e.Result = grid.CurrentCell.MoveTo(row, col); e.Handled = true; return; } col--; if (col == gridModel.Cols.HeaderCount) { row--; col = gridModel.ColCount; } } } e.Handled = true; e.Result = false; break; } } } I attached a sample Stefan WrapRow_2779.zip

Loader.
Live Chat Icon For mobile
Up arrow icon