GridView Hierarchical Data Binding in C#.NET
Kettic DataGridView provides the support of showing hierarchical data to an arbitrary number of levels and establishing the hierarchical at either run time or design time. The GridView control allows users generate hierarchical data automatically at runtime as well as create hierarchical data in C# code for Windows Forms application. When users of the GridView Control do not want add the entire dataset and hierarchy into your C# Windows Forms application, we may need to bind the C# GridView control in C# code manually. To achieve this, we can set up the hierarchy data in C# in Windows Forms template projects.
Bind GridView to Hierarchical Data in C#
When users of the DataGridView control do not need process data binding to the complete dataset and hierarchy, they need process the data binding to hierarchy in C# code, instead of applying the automatic hierarchical databinding mode. Alternatively, we can use the provided collection editor to set the relation at design time. The following C# code samples show how to bind GridView to hierarchical grid data in bound mode and unbound mode.
Create Hierarchical Grid in Bound Mode
To create hierarchy grid in bound mode, the Kettic GridView control offers a GridViewRelation C# class to developers. This GridViewRelation C# class defines the related field in both the parent and child data tables for GridView. The following are the C# code for creating the hierarchical grid data in bound mode.
Create Hierarchical Grid in Unbound mode
The way to create hierarchy grid in unbound mode resembles that of the bound mode. The only difference is to set the unbound mode and create the grid columns first. And then defines the relation in with hierarchy gird and load the hierarchy data. The following C# code samples show how to create hierarchical grid in unbound mode.
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