This sample demonstrates how to manually specify self relations in a table.
Features:
You can manually specify relations in the grouping engine.
The data table does not need to have any data relationships.
This is how the sample looks.
The following code shows registering the data table with the source-list set so that the relation descriptor can resolve the name.
this.gridGroupingControl1.Engine.SourceListSet.Add("SelfReferencialTable", selfreferentialTable);
The following code illustrates how to manually specify the self-relation without using the data table.
GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor(); parentToChildRelationDescriptor.ChildTableName = "SelfReferencialTable"; // same as SourceListSetEntry.Name for childTable (see below) parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails; //Relations specified within different columns of the same table. parentToChildRelationDescriptor.RelationKeys.Add("ID", "RelatedTo"); // Add relation to ParentTable parentgridTableDescriptor.Relations.Add(parentToChildRelationDescriptor);