GGC Multiple relation keys

Hello,
How to set multiple relation keys?

For single relation keys i'm using

parentToChildRelationDescriptor.RelationKeys.Add("Field1", "Field2");

but I can't find example how to add more fields something lik:

parentToChildRelationDescriptor.RelationKeys.Add("Field1", "Field2", "Field3", "Field4");

Thanks!

1 Reply

AA Arulraj A Syncfusion Team August 23, 2018 07:06 AM UTC

Hi Josip, 

Thanks for using Syncfusion product. 

In GridGroupingControl, you could add the ParentRelationKey and ChildRelationKey alone in RelationKeys. If you want to create the child table with multiple relation, you could add the RelationKeys like below code and please refer to the below attached sample, 

Code example  
GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor(); 
parentToChildRelationDescriptor.ChildTableName = "MyChildTable"; 
parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails; 
parentToChildRelationDescriptor.RelationKeys.Add("parentID", "ParentID");//First relation 
parentToChildRelationDescriptor.RelationKeys.Add("parentID2", "ParentID2");//Second relation 
// Add relation to ParentTable  
gridGroupingControl1.TableDescriptor.Relations.Add(parentToChildRelationDescriptor); 
 
this.gridGroupingControl1.Engine.SourceListSet.Add("MyParentTable", parentTable); 
this.gridGroupingControl1.Engine.SourceListSet.Add("MyChildTable", childTable); 
 

Arulraj A 


Loader.
Up arrow icon