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.
Unfortunately, activation email could not send to your email. Please try again.

How to bind to a simple class with properties of List<T> for the child relations

Thread ID:

Created:

Updated:

Platform:

Replies:

130624 May 22,2017 05:08 PM May 23,2017 05:57 AM Windows Forms 1
loading
Tags: GridGroupingControl
David Adkins
Asked On May 22, 2017 05:08 PM

I'm sorry if I'm missing a tutorial. I'm evaluating the GridGroupingControl. I have a class with public properties that I'm setting the DataSource of the grid to a List<T> for that class type. It works but now I'm trying create a relation that would expand a row and show another grid of a different class. The children of a row are a public property of List<T> for the childtype class. It is having a runtime error of   Message=Possible incorrect RelationDescriptor.ChildTableName for Relation relCauses.
Engine.SourceListSet[Causes] returned null.
Did you forget to call Engine.SourceListSet.Add(new SourceListSetEntry(Causes, list)
or did you specify a wrong ChildTableName?

Any advice or a simple demo of Parent/Children/Grandchildren using simple .NET bare bones classes with properties of List<T> for the children?

Arulpriya Ramalingam [Syncfusion]
Replied On May 23, 2017 05:57 AM

Hi David, 

Thanks for your interest in Syncfusion products. 

Query 
Response 
Did you forget to call Engine.SourceListSet.Add(new SourceListSetEntry(Causes, list) 
or did you specify a wrong ChildTableName? 
We have created a simple sample as per your requirement. The relational child table can be added to a parent table in GridGroupingControl by adding the childTable to Engine.SourceListSet. The childTable name should be registered with Engine.SourceListSet, so that the RelationDescriptor can get the child table name. Please make use of below code and samples, 
 
//Assigning Data source to Grid 
gridGroupingControl1.DataSource = parentTable; 
 
//Registering the child table with SourceListSet 
gridGroupingControl1.Engine.SourceListSet.Add("ChildTable",childTable); 
 
//Adding Foreignkey reference to grid 
GridRelationDescriptor relation = new GridRelationDescriptor(); 
relation.RelationKind = RelationKind.RelatedMasterDetails; 
relation.ChildTableName = "ChildTable"; 
relation.RelationKeys.Add("CategoryID", "CategoryID"); 
relation.ChildTableDescriptor.AllowEdit = true; 
gridGroupingControl1.TableDescriptor.Relations.Add(relation); 
 
Already we have provided the information in our user guide document. Please refer to the below link, 

 
Any advice or a simple demo of Parent/Children/Grandchildren using simple .NET bare bones classes with properties of List<T> for the children? 
We have provided the dash board samples with parent/child/grandchild table relations. Please refer the below samples, 
 
Dash Board sample link:  
<InstallLocation> \Syncfusion\EssentialStudio\<Product Version>\Windows\Grid.Grouping.Windows\Samples\Data Sources\Nested Child-Collection Demo\ 

<InstallLocation>\Syncfusion\EssentialStudio\<Product version>\Windows\Grid.Grouping.Windows\Samples\Relation And Hierarchy\Related Master Details Demo 


Regards, 
Arulpriya 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;