Ultragrid/Winforms Grid Hierarchy problem
Question
I need to create a winforms grid with 3 levels, using infragistics ultragrid.
Level 1 has 2 columns (Fixed)
---> Level 2 has 3 columns (Fixed)
--------> Level 3 has Infinite no of columns (Dynamic based on type of level 2 item)
example
Level 1 Item 1 --> 3 Columns (Fixed)
Level 1 Item 1 --> Level 2 item 1 --> 3 Columns (Fixed)
Level 1 Item 1 --> Level 2 item 1 --> Level 3 Item 1 --> 3 Columns (Dynamic)
Level 1 Item 1 --> Level 2 item 2 --> 3 Columns (Fixed)
Level 1 Item 1 --> Level 2 item 2 --> Level 3 Item 1 --> 6 Columns (Dynamic)
How can this be achieved on the grid, specifically Ultragrid?
I am having a massive headache right now
Cheers
Solution
UltraGrid uses the concept of "Bands" to store hierarchical data. Your Level 1 is one band, your Level 2 is another.
Here's where it gets tricky: your Level 3 is actually multiple bands depending on how many dynamic types you have of Level 2 items.
If you're using a DataSet/DataTable as the data source, each DataTable corresponds to a Band, this is simply:
- 1 DataTable for Level 1
- 1 DataTable for Level 2 (with a DataRelation back to DataTable 1)
- N DataTables for Level 3, each with it's own columns, and each having a DataRelation back to DataTable 2
HTH.