This sample demonstrates the manual specifications of the master-detail relations between three separate tables that have primary-key and foreign-key columns in common.

Features:

You can manually specify relations in the grouping engine. The data set does not need to have any data relations. This is the same approach that should be used if you want to set up relationships between independent IList collections.

The following code shows registering the DataTable/IList with the SourceListSet so that the RelationDescriptor can resolve the name.

    		this.gridGroupingControl1.Engine.SourceListSet.Add("MyParentTable",parentTable);
    		this.gridGroupingControl1.Engine.SourceListSet.Add("MyChildTable",childTable);
    		this.gridGroupingControl1.Engine.SourceListSet.Add("MyGrandChildTable", grandChildTable);  

The following code illustrates how to manually specify a relation without using the data set.

    		GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor();
    		parentToChildRelationDescriptor.ChildTableName = "MyChildTable";    // should be same as SourceListSetEntry.Name. 
    		parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails;
    		parentToChildRelationDescriptor.RelationKeys.Add("parentID", "ParentID");

    		// Adding the above relation to ParentTable.
    		gridGroupingControl1.TableDescriptor.Relations.Add(parentToChildRelationDescriptor);  

The code below illustrates subscribing to CurrentCellActivatingEvent in order to select the entire row. In this event, the current cell is moved to colindex() so the rest of the cells in the row are selected irrespective of the cell that is clicked.


    		private void gridGroupingControl1_TableControlCurrentCellActivating
    		(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellActivatingEventArgs e)
    		{
    			GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
    			if (style.TableCellIdentity.TableCellType == GridTableCellType.NestedTableCell)
    			{
                				 Console.WriteLine("NestedTable");
    				return;
    			}
    			 else
    				e.Inner.ColIndex = 0;
    		}