Click to See Complete Forum and Search --> : Datagrid inside another datagrid - Hierarchial Fashion


guru_it2000
March 12th, 2005, 07:14 AM
Do tell me how to make a usercontrol that look in a hierarchial fashion
(tree like structure) with atleast 3 levels wherein each datagrid has another datagrid.

mmetzger
March 12th, 2005, 12:00 PM
Basically inside one of the column definitions, just put a new datagrid. You can either do this in the page or generate them dynamically.

subdigital
March 19th, 2005, 09:49 PM
Basically inside one of the column definitions, just put a new datagrid. You can either do this in the page or generate them dynamically.

the only problem with this method is that the 2nd datagrid has to be entirely contained within 1 column, so space is an issue. If he were to do that yet another time, the page would look ugly and it would defeat the purpose of the hierarchical structure.

What is ideal is for the 2nd datagrid to occupy the entire next row, only indented 10 pixels or so.

There are 2 ways to achieve this (that I know of)
1) you could simulate a datagrid-like appearance with a repeater, and just have a hidden datagrid inside another table row. I have a [+] / [-] toggle button to toggle the visibility of the datagrid.

2) (slightly harder at first, but ultimately cooler) is to programatically insert a new row into the datagrid where the 2nd datagrid will be inserted, and then merge all of the cells together. This does take some time to get going at first.