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.
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.
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 childrow(s)
- The sourcecode is available in C# as a VS.NET 2002 project.
A ready-to-use assembly (including help file).
How to get started:
A step-by-step tutorial that explains the usage of the HierarGrid is available on ASPAlliance
A really advanced sample application with documentation that shows filtering, sorting, paging, exporting with the HierarGrid was written by Nigel Parham. Please note that it is provided as-is like all downloads on this site.
A simple demo that shows editing in the HierarGrid.