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

Binding to Hierarchical Data

RELATED VIDEOS
RadGridView for WinForms Hierarchy Overview
In this video you will learn the various ways you can display hierarchical data in a RadGridView. (Runtime: 12:13)
WinForms RadGridView Hierarchical Data Tutorial

RadGridView can display hierarchical, master-detail data to an arbitrary number of levels. The hierarchical schema can be established at run-time or design-time.

WinForms RadGridView Hierarchical Data

At run-time you can use the RadGridView.AutoGenerateHierarchyFromDataSet to automatically create the hierarchy.

At design-time the steps are:

  1. Configure 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 RadGridView.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.

Use the ShowChildViewCaptions property to show/hide the table header in the child view.

See Also

In this article