Select Items from Data Grid in C#.NET
Kettic DataGridView provides users of GridView Control the selection functionality to select one or more rows or cells from the shown data. This selection features support multiple selection functionality and rows and cells selection in C# code. For example, the GridView component supports a single row selection, multiple rows selection, a single cell selection, as well as multiple cells selection. UI designers can easily customize the GridView selection in C# code in their .NET projects.
How Select Grid Row in C#
To select rows from data grid, we need enable the selection to DataGrid. The default selection setting of Kettic GridView allows users select one row from the data grid. The C# code below demonstrates the default setting of this property.
How to Select Grid Cell in C#
To select cells from data grid, we can change the value of the SelectMode property to SelectCell from the GridViewSelectMode enumeration. The C# code below shows how to achieve this.
How to Select Items in Data Grid
When we selected the items like rows and cells from data grid, the item will be added to the SelectedGridRows and SelectedGridCells collections respectively. The C# code below shows how to access the collections of the cells and rows:
Selection Events for GridView
The Kettic GridView provides two selection C# events available, the ChangedSelection and ChangedCurrentCell. When the ChangedCurrentCell event is fired, the ChangedSelection event will be fired.
CurrentRow and CurrentCell of GridView
The current row and current cell are determined by the item that we selected in basic selection mode. When we select a row or cell in data grid, the GridView will automatically enable the IsCurrent property and the CurrentRow or CurrentCell property will hold an instance of the row or cell. The C# code below shows that how to access the CurrentRow, CurrentCell, and the IsCurrent properties.
UI Controlsfor Windows Forms.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls