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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGroupingControl Relations

Thread ID:





75481 Jul 28,2008 12:28 PM UTC Aug 5,2008 08:32 AM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On July 28, 2008 12:28 PM UTC


I'm new to Syncfusion and was trying out some stuff. But i keep having problems with filling my grid. I already tried some stuff i read on the forum, but it still doesn't work.

So what do I have:
I got a DataSet _data
with 2 DataTables named Table1 and Table2
Table1 has 1 column named T1_A which i made my primary Key
Table2 has 3 columns names T2_A, T2_B and T3_C

What I would like is to have Table2 data in my grid. And for Table2.T2_B i want a combobox like thing with data from Table1.T1_A in which the correct value is selected.

This are the things I did:

grdAircraftRegistr.Engine.SourceListSet.Add("Table2", _data.Tables["Table2"]); grdAircraftRegistr.Engine.SourceListSet.Add("Table1", _data.Tables["Table1"]);

GridRelationDescriptor rdLookup = new GridRelationDescriptor();
rdLookup.Name = "fkLookup";
rdLookup.ChildTableName = "Table1";
rdLookup.RelationKind = Syncfusion.Grouping.RelationKind.ForeignKeyReference;
rdLookup.RelationKeys.Add("T2_B", "T1_A");
rdLookup.ChildTableDescriptor.VisibleColumns.Add("T1_A"); rdLookup.ChildTableDescriptor.SortedColumns.Add("T1_A");
rdLookup.ChildTableDescriptor.AllowEdit = false; rdLookup.ChildTableDescriptor.AllowNew = false;


grdAircraftRegistr.DataSource = _data.Tables["Table2"];

I do not see a column in the grid for Table2.T2_B data. The other fields are visible.

Administrator [Syncfusion]
Replied On July 28, 2008 12:59 PM UTC

Ok, so I managed to have a combobox.
But this is not filled and at the end of the gridcolumns.

i used
rdLookup.RelationKeys.Add("T1_A", "T2_B");
rdLookup.RelationKeys.Add("T2_B", "T1_A");

But why is this combo not filled with my data from Table1?
How do i set this in the column where T2_B is shown?

SubhaSheela R [Syncfusion]
Replied On July 30, 2008 09:00 AM UTC


Thanks for your interest in Syncfusion products.

You can refer our shipped browser sample that discusses about foreign key relations.

Here is the path:

{InstallationDrive}\Documents and Settings\{UserName}\My Documents\Syncfusion\EssentialStudio\\Windows\Grid.Grouping.Windows\Samples\2.0\RelationsAndHierarchy\ForeignKeyReference\CS

Please let me know if it helps.

Subhasheela R

Administrator [Syncfusion]
Replied On July 30, 2008 02:46 PM UTC

Nope, that strategy did not work.
But it did work in this way:

grd.DataSource = _data.Tables["Table2"];

GridTableDescriptor tableDesc = grd.TableDescriptor; tableDesc.Columns["T2_B"].Appearance.AnyRecordFieldCell.CellType = "ComboBox"; tableDesc.Columns["T2_B"].Appearance.AnyRecordFieldCell.DataSource = _data.Tables["Table1"]; tableDesc.Columns["T2_B"].Appearance.AnyRecordFieldCell.DisplayMember = "T1_A"; tableDesc.Columns["T2_B"].Appearance.AnyRecordFieldCell.ValueMember = "T1_A";

SubhaSheela R [Syncfusion]
Replied On August 5, 2008 08:32 AM UTC


Thanks for your update.

We are glad to know that you got solution. Please let me know if you need any further technical assistance.

Subhasheela R


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon