FAQ: Display (Expand/Collapse) Hierarchical in ASP.NET DataGrid
I always see the question of “How to display hierarchical data in a DataGrid” in different Forums, Newsgroup, List Servers...etc etc. Therefore, a lot of articles were written in this topic, some of them use WITH ROLLUP keyword in TSQL, some of them use Nested DataGrid, some of them like injecting data into a Table/DataGrid control during ItemDataBound... etc etc, there're really tens of different approach to do the same result. Today, a new columnist join ASPAlliance, his name is Denis Bauer and his first article is exactly talking in this subject.
He wrote a Custom Control named “HierarGrid“ and just published an article about how to use it. This control is a DataGrid-like control and capable of displaying parent-child relationship / data. Moreover, it will generate a Expand/Collapse (Javascript) and toggle the visibibility of the child data per parent item:
(It's nice and save a lot of time for page developers who want to bind master-detailed datagrid AND write the Javascript)
It's not the first time for me to hear his name - Denis, he is a MS Germany employee and post quite a lot of messages to the ASP.NET Forum, he wrote an article about how to (re)create dynamic control across PostBack (DynamicControl) in the very beginning, he also create a ASP.NET Version Switcher 1.0 which enable us to switch between v1.0 and v1.1 in a simple interface. They're all cool.