# Binding to Hierarchical Data

| RELATED VIDEOS                                                                                                                                                                                                                                            |                                                                                                                                                                                                                    |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [RadGridView for WinForms Hierarchy Overview](http://tv.telerik.com/watch/winforms/radgrid/radgridview-winforms-hierarchy-overview)<br>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](https://www.telerik.com/products/winforms/documentation/assets/619ce88f604aac6ad8a447f6afc48e58/gridview-hierarchical-grid-binding-to-hierarchical-data001.png) |

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](https://www.telerik.com/products/winforms/documentation/assets/afb8f4c9ab4bae4c2d1d5d11180caef9/gridview-hierarchical-grid-binding-to-hierarchical-data002.png)

At run-time you can use the RadGridView\.AutoGenerateHierarchyFromDataSet to [automatically create the hierarchy](https://www.telerik.com/products/winforms/documentation/controls/gridview/hierarchical-grid/binding-to-hierarchical-data-automatically).

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](https://www.telerik.com/products/winforms/documentation/controls/gridview/hierarchical-grid/tutorial-binding-to-hierarchical-data) for step by step instructions.

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

## See Also

* [Binding to Hierarchical Data Automatically](https://www.telerik.com/products/winforms/documentation/controls/gridview/hierarchical-grid/binding-to-hierarchical-data-automatically)

* [Binding to Hierarchical Data Programmatically](https://www.telerik.com/products/winforms/documentation/controls/gridview/hierarchical-grid/binding-to-hierarchical-data-programmatically)

* [Creating hierarchy using an XML data source](https://www.telerik.com/products/winforms/documentation/controls/gridview/hierarchical-grid/creating-hierarchy-using-an-xml-data-source)

* [Hierarchy of one to many relations](https://www.telerik.com/products/winforms/documentation/controls/gridview/hierarchical-grid/hierarchy-of-one-to-many-relations)

* [Load-On-Demand Hierarchy](https://www.telerik.com/products/winforms/documentation/controls/gridview/hierarchical-grid/load-on-demand-hierarchy)

* [Object Relational Hierarchy Mode](https://www.telerik.com/products/winforms/documentation/controls/gridview/hierarchical-grid/object-relational-hierarchy-mode)

* [Self-Referencing Hierarchy](https://www.telerik.com/products/winforms/documentation/controls/gridview/hierarchical-grid/self-referencing-hierarchy)

* [Tutorial Binding to Hierarchical Data](https://www.telerik.com/products/winforms/documentation/controls/gridview/hierarchical-grid/tutorial-binding-to-hierarchical-data)
