Edit this page

What you should know

A unique feature for Telerik RadGrid is the support for hierarchical representation of related data tables (DataSet).

Hierarchy Elements

Master Table

The MasterTableView is the topmost table of the hierarchical structure. It is a GridTableView Class with GridTableViewCollection Class. The collection holds the so called DetailTables - tables related to the fields of the MasterTable. Each DetailTable can have its own GridTableViewCollection with other Detail Tables, thus forming the hierarchical structure.

You can look on the MasterTable as a Root for the hierarchical tree. All tables underneath will be the tree nodes. The MasterTable is an object and has own sections of properties in Visual Studio.

Detail Tables

Detail tables are the inner tables of the grid. They are related to a field in its parent table.

Each Detail Table is placed in an item (row) of its parent table. This special item is called NestedViewItem.

NestedViewItem

Expand/Collapse all

RadGrid’s hierarchy structure has been extended with buttons in the hierarchy expand column headers that allow all detail items ona given level to be expanded/collapsed. The buttons in question are switched on through theEnableHierarchyExpandAll property exposed both on the level of the grid and the table views.

The new expand-all functionality supports all hierarchy load modes.

When you have grouping and hierarchy combined in a common table view, the visibility of the hierarchy expand-all button depends on whether the expand-all button for the last group level is expanded/visible.

Controlling Expanded State

By default, the items in a hierarchical RadGrid are collapsed. In order to expand them automatically, you can use the HierarchyDefaultExpanded property. If the hierarchy structure contains several levels, the property should be set for every GridTableView instance separately.

<MasterTableView HierarchyDefaultExpanded="true">

Since Q3 2013 version, RadGrid also provides the convenient RetainExpandStateOnRebind property. When you enable it, the expanded state of the parent items will be preserved automatically on rebinding actions like Paging, Editing, etc.

See Also