ColumnView.DeleteSelectedRows() Method

Deletes the selected rows/cards in multiple selection mode or focused row/card in single selection mode.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v21.1.dll


public virtual void DeleteSelectedRows()


In single row selection mode, this method deletes the focused row. In multiple row selection mode this method deletes the selected rows. In multiple cell selection mode this method deletes the rows to which selected cells belong.

The current selection mode is determined by the ColumnViewOptionsSelection.MultiSelect and GridOptionsSelection.MultiSelectMode options.

For Grid Views and their descendants the DeleteSelectedRows method affects both the selected data rows and group rows. In Card Views, this method deletes the selected cards. To get references to the selected rows, use the ColumnView.GetSelectedRows method. To get selected cells (in multiple cell selection mode) use the GridView.GetSelectedCells method.

To delete a specific row use the ColumnView.DeleteRow method.


If the DeleteSelectedRows method is called for a master row, only this row is removed. The detail clone view’s records remain untouched.


Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the DeleteSelectedRows member must not be invoked for these Views. The DeleteSelectedRows member can only be used with real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.

The code sample below illustrates how to delete the selected row(s) when a user presses Delete.

gridControl1.ProcessGridKey += GridControl1_ProcessGridKey;

private void GridControl1_ProcessGridKey(object sender, KeyEventArgs e)
    var grid = sender as GridControl;
    var view = grid.FocusedView as GridView;
    if (e.KeyData == Keys.Delete)
        e.Handled = true;
See Also