Hi,
How can i set a tabledescriptor for a nested table. I am binding a untyped Dataset to GridGroupingControl. The Dataset is filled at runtime.
I can set the tabledescriptor with it''s Columns for the parent table at designtime but how can i set the tabledescriptor for the child table at designtime ?
TIA,
Oliver
AD
Administrator
Syncfusion Team
March 31, 2005 10:31 AM UTC
At runtime, you can get at the child table descriptors using:
GridTableDescriptor td = this.gridGroupingControl1.GetTableDescriptor("RelationNameOrTableName");
At design time, look under the TableDescriptor property. There is a collection called Relations. Adding a relation using the collection editor gives you access to the a TableDescriptor object for that related table. Is this what you need?
AD
Administrator
Syncfusion Team
March 31, 2005 12:43 PM UTC
Ok, now how do I bind the Relation I created in design-view to the Relation i create in code with the following line :
m_DataSet.Relations.Add(m_DataSet.Tables[0].Columns[Proposal.Constants.DataBase.col_MaterialNr], m_DataSet.Tables[1].Columns[Proposal.Constants.DataBase.col_MaterialNr]);
Or in other words how do I use the binding i created in design-view at runtime ?
AD
Administrator
Syncfusion Team
March 31, 2005 01:04 PM UTC
When you call dataset.Relations.Add, make sure you use the overload that lets you specify a relation name, and then make sure you pass the same string that you used in the designer.
Here is a little sample that sets Appearance.AnyCell.BackColor on a child table at design time, but creates and populates the dataset at runtime.
http://www.syncfusion.com/Support/user/uploads/GGC_Sample_1b94785e.zip
AD
Administrator
Syncfusion Team
March 31, 2005 02:11 PM UTC
seems to work until i try to set the forms visibility to true. Then i get the following Output:
Could not find Field with name in Teile
Could not find Field with name Gesamtpreis in Teile
Could not find Field with name Summe Geräte in Teile
Could not find Field with name Menge in Teile
Could not find Field with name Vorschlagsmenge in Teile
Could not find Field with name Bestellmenge in Teile
Could not find Field with name Kommentar in Teile
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.UpdateColumnWidths(Boolean force)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.UpdateColumnWidths()
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.UpdateColumnWidths(Boolean force)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.UpdateColumnWidths()
at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.VisibleColumns_TotalWidthRequest(Object sender, CancelEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptorCollection.OnTotalWidthRequest(CancelEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptorCollection.get_TotalWidth()
at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.GetHorizontalScrollWidth(Boolean isNested)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.GetHorizontalScrollWidth()
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.GetHorizontalScrollWidth()
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.SynchronizeGridWithEngine()
An unhandled exception of type ''System.IndexOutOfRangeException'' occurred in syncfusion.grid.grouping.windows.dll
Additional information: Index was outside the bounds of the array.
catched at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.SynchronizeGridWithEngine() in :line 0
Could not find Field with name in Teile
Could not find Field with name Gesamtpreis in Teile
Could not find Field with name Summe Geräte in Teile
Could not find Field with name Menge in Teile
Could not find Field with name Vorschlagsmenge in Teile
Could not find Field with name Bestellmenge in Teile
Could not find Field with name Kommentar in Teile
Any suggestions ?
Regards
AD
Administrator
Syncfusion Team
March 31, 2005 03:28 PM UTC
It sounds like you have not initialized the dataset by the time the grid is trying to draw the schema information you provided in the designer. In the sample I attached earlier, the dataset was initialized in the form.load before the grid was drawn.
If you want to draw the grid first, and then populate the dataset, then you will have to populate the Columns collections for both the parent and child tables in teh designer. Additionally, in form.Load, you may have to add a set ot RelationKeys that specify the relation. Here is the sample with a button that populates the dataset from a button handler after the form has been loaded.
http://www.syncfusion.com/Support/user/uploads/uninitialzednestedtable_72ef9381.zip
AD
Administrator
Syncfusion Team
April 1, 2005 08:11 AM UTC
Perfect, seems like the following line did the trick:
Syncfusion.Grouping.Engine.ThrowExceptionIfSourceListSetEntryNotFound = false;
thanks for your help