How to select a row programmatically in WinForms GridGroupingControl?
By default, the selection can be done in grid by using mouse. This article explains how to add selection programmatically in WinForms GridControl, WinForms GridGroupingControl and WinForms GridDataBoundGrid.
1. GridControl
C#
this.gridControl1.Selections.Add(GridRangeInfo.Row(3));VB
Me.gridControl1.Selections.Add(GridRangeInfo.Row(3))2. GridGroupingControl
The GridGroupingControl has two kinds of selections. They are
1. Range selection
2. Record selection
Range selections
The record selection can be done by adding the range of row to the selection.
C#
this.gridGroupingControl1.TableModel.Selections.Add(GridRangeInfo.Row(4));VB
Me.gridGroupingControl1.TableModel.Selections.Add(GridRangeInfo.Row(4))Record selection
The record selection can be done by using SetSelected method of Record which needs to be selected.
C#
this.gridGroupingControl1.Table.Recods[0].SetSelected(true);Me.gridGroupingControl1.Table.Recods[0].SetSelected(true)3. GridDataBoundGrid
Add the row in Selections from GridDataBoundGrid.
C#
this.gridDataBoundGrid1.Selections.Add(GridRangeInfo.Row(2));VB
Me.gridDataBoundGrid1.Selections.Add(GridRangeInfo.Row(2))Samples:
C#: Selections
VB: Selections
Conclusion
I hope you enjoyed learning about how to select a row in GridGroupingControl.
You can refer to our WinForms GridGroupingControl feature tour page to know about its other groundbreaking feature representations and WinForms GridGroupingControl documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!