Home Forums WinForms controls Xceed Grid for WinForms Single grid displaying multiple Datatables Reply To: Single grid displaying multiple Datatables

User (Old forums)
Member
Post count: 23064

You could try something like the following. The idea is to make the GridControl unbound, but use as many first level DetailGridTemplate as there are tables, and bind each detail grid to a specific table :

<code>
gridControl1.BeginInit();

gridControl1.DataRowTemplate.Height = 0;

gridControl1.SynchronizeDetailGrids = false;

foreach( DataTable dataTable in dataTableToShowList )
{
DetailGrid detailGridTemplate = new DetailGrid();

detailGridTemplate.HeaderRows = new Xceed.Grid.ColumnManagerRow();

detailGridTemplate.SetDataBinding( dataTable, string.Empty );

gridControl1.DetailGridTemplates.Add( detailGridTemplate );
}

gridControl1.UpdateDetails();

gridControl1.EndInit();

Xceed.Grid.DataRow row = gridControl1.DataRows.AddNew();
row.EndEdit();

</code>

This will require some tweaking to make it look appropriate (no GroupByRow, etc…), but with this you should be able to get where you want.

Imported from legacy forums. Posted by André (had 3090 views)