Obtaining Selected Rows and Cells
Obtaining Selected Rows
Selected rows/nodes can be obtained using the DataControlBase.SelectedItems property. These properties represent collections that provide indexed access to selected rows/nodes. To obtain selected row handles, use the DataControlBase.GetSelectedRowHandles method.
Obtaining Selected Cells
Selected cells can be obtained using the TableView.GetSelectedCells method. This method returns an array of GridCell objects that contain cell coordinates (row and column).
Example: How to Process Selected Rows
This example shows how to process selected rows, and unselect rows where UnitPrice is less than ‘$10’.
private void ProcessSelectedRows(GridControl gridControl, GridViewBase view) {
view.BeginSelection();
foreach (int rowHandle in view.GetSelectedRowHandles()) {
if (Convert.ToDouble(gridControl.GetCellValue(rowHandle, "UnitPrice")) < 10)
gridControl.UnselectItem(rowHandle);
}
view.EndSelection();
}
See Also