1

I'm beginner in using DevExpress tools. I can not find any property, that shows the gridControl's row selections state, to my if statement.

Any suggestion?

LewoSoft
  • 73
  • 1
  • 2
  • 12
  • I don't know the DevExpress grid control. However, most grid controls expose selection in one or both of two ways. Either something like `SelectedIndex` or `SelectedRow` on the grid (possibly in plural) or, a flag like `IsSelected` (or just `Selected`) on an individual row(s) (which is usually exposed as a `Rows` collection on the grid – Flydog57 Jan 16 '22 at 01:28
  • 1
    Devexpress grid control can have many views. So, you can find the selected row in the grid control's views. I thing Grid View's `IsRowSelected` method or `GetSelectedRows` method that returns the selected rows in the grid will help you. – muludag Jan 17 '22 at 10:33
  • @muludag Yes, I didn't understand that gridView is part of the gridControl tool. With gridView now I can already check the number of selected rows. – LewoSoft Jan 18 '22 at 12:12

1 Answers1

3

You can use the ColumnView.SelectedRowsCount property to return the number of selected rows/cards.

if (gridView1.SelectedRowsCount > 0) {    
    int[] selectedRowHandles = gridView1.GetSelectedRows();
    for (int i = 0; i < selectedRowHandles.Length; i++) {
      //... object rowObject = gridView1.GetRow(selectedRowHandles[i]);
    }
}
DmitryG
  • 17,677
  • 1
  • 30
  • 53