Tuesday 19 February 2008

HierarGrid - A hierarchical DataGrid that displays master-detail relations

 

Problem:

The ASP.NET DataGrid is a popular control to display data in a table form with editing, paging and sorting capabilites.
However it is only suitable to display single DataTables - there is no support for parent-child relations.

Goal:

To create a control that provides the standard DataGrid functionality and at the same time can display parent-child relations using templates to display the child elements.

Procedure:

Create a custom control called HierarGrid that derives from the DataGrid and a custom DataGridColumn called HierarColumn.

The HierarGrid takes a DataSet that contains relations between the tables.

While iterating over the parent table it checks the related tables for child rows and if one is found it dynamically loads a template for the child

row(s)

The template is rendered invisibly into the custom HierarColumn and when the user clicks the plus icon, the template content is copied via JavaScript into a newly created TableRow.

Download (V2.2):
How to get started:

By Denis Bauer
Share:

0 comments:

Post a Comment