RadGrid for ASP.NET AJAX

RadControls for ASP.NET AJAX

If you work in hierarchy mode, you can define when the DataBind for GridTableView will occur. In order to do this, you need to set the following property:

GridTableView.HierarchyLoadMode

The possible values are:

  • HierarchyLoadMode.ServerBind - all child GridTableViews will be bound immediately when DataBind occurs for a parent GridTableView or RadGrid.

  • HierarchyLoadMode.ServerOnDemand - DataBind of a child GridTableView would only take place when an item is Expanded (see GridItem.Expanded). This is the default value.

  • HierarchyLoadMode.Client is similar to HierarchyLoadMode.ServerBind, but items are expanded client-side, using JavaScript manipulations, instead of postback to the server. In order to use client-side hierarchy expand, you will need to set also ClientSettings.AllowExpand.Collapse to true.

Changing this property value impacts the performance the following way:

  • In HierarchyLoadMode.ServerBind mode:

    • The roundtrip to the database happens only once - when the grid is bound.

    • The ViewState holds all data for the detail tables.

    • Only detail table-views of the expanded items are rendered.

    • You need to postback to the server to in order to expand an item.

  • In HierarchyLoadMode.ServerOnDemand mode:

    • The roundtrip to the database happens when the grid is bound and when an item is expanded.

    • The ViewState holds data only for the visible Items (the smallest possible ViewState).

    • Only detail table-views of the expanded items are rendered.

    • You need to postback to the server in order to expand an item.

  • In HierarchyLoadMode.Client mode:

  • The roundtrip to the database happens only when grid is bound.

  • The ViewState holds all detail tables data.

  • All items are rendered - even if not visible (not expanded).

  • No postback to the server is needed to expand an item - expand/collapse of hierarchy items is managed client-side.

Details about the hierarchy load modes of Telerik RadGrid and how to use them to optimize the control's performance you can find here.

Using different load modes in Telerik RadGrid

As HierarchyLoadMode is a GridTableView setting (not RadGrid property) you can even more fine tune the way that Telerik RadGrid handles loading of hierarchy tables. You can set HierarchyLoadMode.Client for tables that need fast view and HierarchyLoadMode.ServerBind for tables that are less likely to be accessed.

Thus you can balance the loading of the grid between:

  • the client - this will require more bandwidth but will assure less load to the server and database and quicker expand.

  • the server - will save some client-load for the inner tables of the grid.

The example below shows the advanced hierarchy model of Telerik RadGrid with mixed mode expand/collapse (client-side and server-side). A three level hierarchy is demonstrated with Customer Master Table and two nested Detail Tables: Orders and OrderDetails. The first level of hierarchy uses client-side (HierarchyLoadMode.Client) expand and the second level uses server-side mode (HierarchyLoadMode.ServerBind)

Mixed Load Mode