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

GGC: Finding column descriptors added by ForeignKeyReference relation

When adding a ForeignKeyReference relation to a table descriptor, the table is extended with columns from the child table. The columns are prefixed with the name of the relation descriptor. Is there an easy way to find these column descriptors?

3 Replies

DJ Daniel Jebaraj Syncfusion Team February 24, 2005 07:19 PM

Test. Please ignore update. >When adding a ForeignKeyReference relation to a table descriptor, the table is extended with columns from the child table. The columns are prefixed with the name of the relation descriptor. Is there an easy way to find these column descriptors?


AD Administrator Syncfusion Team February 24, 2005 07:53 PM

Hi Sigurd, you can loop through all the columns of the related table when you access the ChildTableDescriptor of the RelationDesriptor, e.g. in the ForeignKeyReference example: this.gridGroupingControl1.DataSource = table; mainTd.Name = "ForeignKeyReference"; mainTd.Columns.LoadDefault(); foreach (RelationDescriptor rd in mainTd.Relations) { if (rd.RelationKind == RelationKind.ForeignKeyReference) { foreach (FieldDescriptor fd in rd.ChildTableDescriptor.Fields) { string name = countriesRd.Name + "_" + fd.Name; GridColumnDescriptor cd = mainTd.Columns.FindByMappingName(name); if (cd != null) Console.WriteLine(cd.Name); } } } Stefan >When adding a ForeignKeyReference relation to a table descriptor, the table is extended with columns from the child table. The columns are prefixed with the name of the relation descriptor. Is there an easy way to find these column descriptors?


SR Sigurd Ringbakken February 25, 2005 06:00 AM

>you can loop through all the columns of the related table when you access the ChildTableDescriptor of the RelationDesriptor, e.g. in the ForeignKeyReference example: Yes, but I was hoping I could avoid that and rather find them in a collection somewhere.

Loader.
Live Chat Icon For mobile
Up arrow icon