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. Image for the cookie policy date

Foreign key reference

I experience some strange behaviour with the grouping grid and foreing key reference. I have a main DataTable used as data source for the grid and foreign key DataTable used as the SourceListSet. As long as both tables are in the same DataSet, everything works fine. However, if the two DataTables are in different DataSets the foreign key doesn''t work anymore. (No drop down arrow and a null reference error if I try to enter anything in the joined column.) I set up the foreign key lookup like this: gridControl.Engine.SourceListSet.Add(lookupTable.TableName, lookupTable); GridRelationDescriptor grd = new GridRelationDescriptor(); grd.Name = lookupTable.TableName; grd.RelationKind = RelationKind.ForeignKeyReference; grd.ChildTableName = lookupTable.TableName; // SourceListSet name for lookup grd.RelationKeys.Add(mainTableKey, lookupTableKey); mainTableDescriptor.Relations.Add(grd); This works if lookupTable is in the same DataSet as the main DataTable but not otherwise. In fact it seems like the grid ignores the provided lookupTable and instead searches for a table with the provided name in the main DataSet. Is it not possible to use a lookupTable from a different DataSet? Am I missing something here?

1 Reply

AD Administrator Syncfusion Team May 6, 2005 04:42 PM UTC

Here is a sample with the main table and the foreign key table in 2 different datasets. It seems to work OK. http://www.syncfusion.com/Support/user/uploads/GGC_ForeignKeyReference_a924c4a.zip

Live Chat Icon For mobile
Up arrow icon