Single Row Selection

The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.

Product Name
Category
Unit Price
Units In Stock
Quantity Per Unit
Discontinued
Chai Beverages $18.00 39 10 boxes x 20 bags
Chang Beverages $19.00 17 24 - 12 oz bottles
Aniseed Syrup Condiments $10.00 13 12 - 550 ml bottles
Chef Anton's Cajun Seasoning Condiments $22.00 53 48 - 6 oz jars
Chef Anton's Gumbo Mix Condiments $21.00 0 36 boxes
Grandma's Boysenberry Spread Condiments $25.00 120 12 - 8 oz jars
Uncle Bob's Organic Dried Pears Produce $30.00 15 12 - 1 lb pkgs.
Northwoods Cranberry Sauce Condiments $40.00 6 12 - 12 oz jars
Mishi Kobe Niku Meat/Poultry $97.00 29 18 - 500 g pkgs.
Ikura Seafood $31.00 31 12 - 200 ml jars
of 8

Selected Product: Chai

The Data Grid component allows users to click a row to select it. Use the SingleSelectedDataRow property to specify the selected data row in code. To track selection changes in this mode, use the SingleSelectedDataRowChanged event or the two-way synchronization as demonstrated in this module.

Multiple Row Selection

The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.

Product Name
Category
Unit Price
Units In Stock
Chai Beverages $18.00 39
Chang Beverages $19.00 17
Aniseed Syrup Condiments $10.00 13
Chef Anton's Cajun Seasoning Condiments $22.00 53
Chef Anton's Gumbo Mix Condiments $21.00 0
Grandma's Boysenberry Spread Condiments $25.00 120
Uncle Bob's Organic Dried Pears Produce $30.00 15
Northwoods Cranberry Sauce Condiments $40.00 6
Mishi Kobe Niku Meat/Poultry $97.00 29
Ikura Seafood $31.00 31
of 8
Selected products:
  • Chai
  • Chang
  • Aniseed Syrup
  • Chef Anton's Cajun Seasoning

Set the SelectionMode property to DataGridSelectionMode.MultipleSelectedDataRows to enable multiple selection in the Data Grid component. To select a range of rows, users should hold down the Shift key and click the first and last rows in the range. To add/remove a row to/from selection, users should hold down the Ctrl key and click the row.

Use the MultipleSelectedDataRows property to access/specify the selected items. To track selection changes in this mode, use the MultipleSelectedDataRowsChanged event or the two-way synchronization as demonstrated in this module.

Multiple Selection with Optimized Performance

The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.

Product Name
Category
Unit Price
Units In Stock
Quantity Per Unit
Discontinued
Chai Beverages $18.00 39 10 boxes x 20 bags
Chang Beverages $19.00 17 24 - 12 oz bottles
Aniseed Syrup Condiments $10.00 13 12 - 550 ml bottles
Chef Anton's Cajun Seasoning Condiments $22.00 53 48 - 6 oz jars
Chef Anton's Gumbo Mix Condiments $21.00 0 36 boxes
Grandma's Boysenberry Spread Condiments $25.00 120 12 - 8 oz jars
Uncle Bob's Organic Dried Pears Produce $30.00 15 12 - 1 lb pkgs.
Northwoods Cranberry Sauce Condiments $40.00 6 12 - 12 oz jars
Mishi Kobe Niku Meat/Poultry $97.00 29 18 - 500 g pkgs.
Ikura Seafood $31.00 31 12 - 200 ml jars
of 8

The total count of selected rows: 0 (stored selected rows: 0, stored unselected rows: 0)

Enable multiple selection mode with optimized performance if the Data Grid contains a significant number of rows. To do this, set the SelectionMode property to DataGridSelectionMode.OptimizedMultipleSelection and specify the KeyFieldName property.

In this mode, the Data Grid does not store row data objects and information about all the selected rows. The Data Grid stores row key values instead. If you select all rows in the Data Grid UI or in code, and then unselect rows, the component stores keys of unselected rows only (and vice versa). This mode reduces the amount of stored data and increases performance, but may corrupt database integrity.

Add the DxDataGridSelectionColumn to select data rows with checkboxes. Set the SelectAllMode property to AllPages to select all data rows simultaneously with the Select All checkbox. To track selection changes in this mode, use the OptimizedMultipleSelectionChanged event.