GridTableDescriptor mainTd = this.gridGroupingControl1.TableDescriptor;
GridRelationDescriptor usStatesRd = new GridRelationDescriptor();
usStatesRd.Name = "State";
usStatesRd.RelationKind = RelationKind.ForeignKeyReference;
usStatesRd.ChildTableName = "USStates"; // SourceListSet name for lookup
usStatesRd.RelationKeys.Add("State", "Key");
mainTd.Relations.Add(usStatesRd);
Please refer to the following Dashboard sample, in which we have adding the foreign key reference to the GridGroupingControl.
Sample Location:
<InstalledLocation>\Syncfusion\EssentialStudio\<VersionNo>\Windows\Grid.Grouping.Windows\Samples\Relation And Hierarchy\Foreign-Key Reference Demo\CS
Regards,
Adhi
Code example:
this.groupingGrid1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(groupingGrid1_QueryCellStyleInfo);
void groupingGrid1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.EmptySectionRowHeaderCell)//check the celltype of your child table and set the condition accordingly.
e.Style.CellType = GridCellTypeName.ComboBox;
e.Style.DataSource = list;
}
Regards,
AL.Solai.