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) |
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.
At run-time you can use the RadGridView.AutoGenerateHierarchyFromDataSet to automatically create the hierarchy.
At design-time the steps are:
Configure data source components for each table to be displayed.
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.
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.