New to Telerik UI for WinForms? Download free 30-day trial

Creating Hierarchical Grids

RadGridView has the ability to represent hierarchical master-detail data. Its hierarchical schema set up either at design-time or at runtime using the control API. You can also set the AutoGenerateHierarchy property to True and bind to a System.Data.DataSet type data source to have RadGridView automatically build a hierarchical schema.

Create hierarchical grid

radGridView1.AutoGenerateHierarchy = true;

RadGridView1.AutoGenerateHierarchy = True

The general steps to setting up hierarchical data manually are:

  1. Configure the data source components for each table to be displayed.

  2. Using GridViewTemplate.ChildGridViewTemplates collection, create a hierarchy of templates, one for every level of master-detail relations. Each template should be bound to its own data source.

  3. Populate the Relations collection with GridViewRelation objects. These objects define the relations between views in the hierarchy. The ParentTemplate and ChildTemplate properties of GridViewRelation object are set to the existing templates. ParentColumnNames and ChildColumnNames collections are filled with the names of the fields of the corresponding data sources. See the topic Tutorial: Binding to Hierarchical Data for step by step instructions.

See Also

In this article