We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Giving Relation in Grid

I am using vs 2005. i have problem for giving relation in GridGroupingControl. I am using a datatable as my parentTable and want to use TableDescriptor as childTable(because i have to span columns in child table). so is there any way to give relation between those two. plz help me to get out of this problem.

Thanks,
Kiran

2 Replies

AD Administrator Syncfusion Team February 21, 2007 07:59 PM UTC

Hi Kiran,

The Manual Relation-Masterdetails sample demonstrates how to manually specify the master-detail relations between three separate tables that have primary key and foreign key columns in common. You can manually specify relations in the grouping engine. The DataSet does not need to have any DataRelations. This is the same approach that should be used if you want to set up relationships between independent IList collections.

Here is a sample
RelatedMasterDetails.zip

Best regards,
Haneef


KI Kiran February 22, 2007 11:48 AM UTC

Hi Haneef,
Thank you for giving reply for my message.
But my actual problem is this when i give any relation to its child it will not open within the parent.

my code is like

This will fill my YearTable with require field

DataTable YearTable = new DataTable();
YearTable = GetYearTable();
YearTable.Name = "YearTable";

And then this will give all the relation ship between DataTable and GridTableDescritor

GridTableDescriptor td = new GridTableDescriptor();
GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor();

td.Name = "FreqTable";
parentToChildRelationDescriptor.ChildTableName = td.Name;
parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails;
parentToChildRelationDescriptor.RelationKeys.Add("Id", "ID");
parentToChildRelationDescriptor.Name = "ParentToChild";
this.gridGroupingControl1.TableDescriptor.Relations.Add(parentToChildRelationDescriptor);


this.gridGroupingControl1.Engine.SourceListSet.Add("YearTable", YearTable);

//Here td is my GridTableDescriptor in which i manually added some columns using gridcloumndescriptor and then span it using GridColumnSpanDescriptor
and then set it in a gridColumnSetDescriptor
atfer this i add this to td.

td = this.gridGroupingControl1.Engine.TableDescriptor.Relations["ParentToChild"].ChildTableDescriptor;
this.gridGroupingControl1.DataSource = YearTable;

but here its not comes the way i want. i just want a DataTable as a Parent Table and GridTableDescriptor as Child Table. To Achive This what i have to do? Plz guide me for this problem.

Thanks,
Kiran

Loader.
Live Chat Icon For mobile
Up arrow icon