$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
DataGridView WinForms Component
Hierarchical data binding of GridView C#.NET control in Windows Forms applications
Home > WinForms UI Controls > User Manual > Auto Data Binding in C#

Bind GridView to Hierarchical Data Automatically

The Kettic DataGridView Control offers the hierarchical data structure support, which is able to display hierarchical master-detail data. This grid component allows UI designer process the hierarchical data at design time as well as in run time with the C# API included in the grid control. It also supports process the data automatically in according to the data structures. Furthermore, the Kettic Data Grid control presents multiple child data views, which is similar with a tree hierarchy.

Hierarchical Data Binding Automatically

GridView component is capable of binding to hierarchical data automatically. To create hierarchical data automatically, we need set the property, AutoCreateHierarchy, as true to initialize the behavior. And the type of data source for the grid must be System.Data.DataSet and relations have been defined in the data structure at run time. After that, the hierarchy data can be created automatically. The following is an example that demonstrates how to generate hierarchy data automatically in a few simple steps.
  • Uses the CategoryID of the Northwind dataset to join the Categories and Products
  • GridView Component Data Binding
  • Binding C# GridView to Data Source
  • And then, we need fill the categories and products data tables with C# code below at runtime,
  • Change the value of the property, AutoCreateHierarchy, to true for the GridView
  • Assign the data set which includes both tables to the grid DataSource and the DataMember, the parent table.
  • Configure the C# code as necessary at design time.

private void BindToHierarchicalGridAutomatically_Load(object sender, EventArgs e)
ketticGridView1.AutoCreateHierarchy = true;
ketticGridView1.DataSource = this.nwindDataSet;
ketticGridView1.DataMember = "Categories";
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