Skip to main content

GridView.SelectCell(Int32, GridColumn) Method

Selects the cell.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation


public virtual void SelectCell(
    int rowHandle,
    GridColumn column


Name Type Description
rowHandle Int32

The cell’s row handle.

column GridColumn

The cell’s column.


A cell is located at the specified row and column’s intersection.

The SelectCell method does nothing if multiple cell selection (block selection) is disabled. To ensure that block selection is in effect, use the GridView.IsCellSelect property. To unselect a cell use the GridView.UnselectCell method.

When the selection changes, the ColumnView.SelectionChanged event occurs.

The code sample below illustrates how to select the entire grid column when users hold the CTRL button and click on a column’s header.

gridView1.OptionsSelection.MultiSelect = true;
gridView1.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CellSelect;
gridView1.MouseDown += GridView1_MouseDown;

private void GridView1_MouseDown(object sender, MouseEventArgs e)
    GridView view = sender as GridView;
    GridViewInfo gridInfo = view.GetViewInfo() as GridViewInfo;
    GridHitInfo hitInfo = view.CalcHitInfo(e.Location);

    if (hitInfo.InColumnPanel && e.Button == System.Windows.Forms.MouseButtons.Left && ModifierKeys == Keys.Control)
        for (int i = 0; i < hitInfo.Column.View.RowCount; i++)
            view.SelectCell(i, hitInfo.Column);
        ((DXMouseEventArgs)e).Handled = true;


The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SelectCell(Int32, GridColumn) method.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also