Home Forums WinForms controls Xceed Grid for WinForms Hierarchical representation of data Reply To: Hierarchical representation of data

Xceed Support
Member
Post count: 5658

I’m not sure to completely understand; You want to create a master / detail grid with 3 levels?

We can abstract the fact that it is a Oracle database. You need to create a dataset with the relations between those 3 tables.

Here is a snippet of code that shows how to bind your dataset to GridControl:

<code>
gridControl1.BeginInit();

gridControl1.SetDataBindings( dataSet1, “mainTable” );

DetailGrid detailGrid1 = new DetailGrid();
detailGrid1.SetDataBindings( dataSet1, “mainTable.RelationNameBetweenMainAndFirstChildTable” );
gridControl1.DetailGridTemplates.Add( detailGrid1 );

DetailGrid detailGrid2 = new DetailGrid();
detailGrid2.SetDataBindings( dataSet1, “mainTable.RelationNameBetweenMainAndFirstChildTable.RelationNameBetweenFirstChildTableAndSecondChildTable” );
detailGrid1.DetailGridTemplates.Add( detailGrid2);

DetailGrid detailGrid3 = new DetailGrid();
detailGrid3.SetDataBindings( dataSet1, “mainTable.RelationNameBetweenMainAndFirstChildTable.RelationNameBetweenFirstChildTableAndSecondChildTable.RelationNameBetweenSecondChildTableAndThirdChildTable” );
detailGrid2.DetailGridTemplates.Add( detailGrid3);

gridControl1.UpdateDetailGrids();

gridControl1.EndInit();
</code>

You can also take a look at our samples, we have some that illustrate well the Master / Detail subject. You can also look at our <a href=”http://doc.xceedsoft.com/products/Xceedgrid/Overview_-_Editing.html”>Providing Data</a> topic in our help section.

Imported from legacy forums. Posted by CharlesB (had 245 views)