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

GridDataControl not showing correct parent -child relationship for tables related by two DataColumns

I have a GridDataControl intended to show a subordinate table ("TestData") related to the parent ("TestResults") related by "Output Name" and "Test Name" columns.
Attached JPG shows expanded child table for first parent row showing rows for first three parent rows. I suppose I am not defining the relationship correctly.
I am using Visual Studio 2015 and Syncfusion version 15.2.0.40 

Also, when I collapse the child table, I get a InvocationException error (also attached) which seems to be due to a missing key, probably also due to incorrect table setup.

XAML excerpt:

            <syncfusion:TabItemExt Header="Test Results"

                          <syncfusion:GridDataControl x:Name="testResultsGrid"   Margin="5"               

                    AutoPopulateColumns="True"

                    AutoPopulateRelations="True"

                    HideEmptyChildGrid="True"

                    ShowAddNewRow="False" AllowEdit="False" AllowDelete="False" ColumnSizer="Auto" EnableTriStateSorting="True"

                    ResizingColumns="dataGrid_ResizingColumns"/>


Code behind:

            DataTable testResultsTable = new DataTable("TestResults");

            dataSet.Tables.Add(testResultsTable);

            testResultsTable.Columns.Add("Output Name", typeof(string));

            testResultsTable.Columns.Add("Test Name", typeof(string));

            testResultsTable.Columns.Add("Test Type", typeof(string));

            testResultsTable.Columns.Add("Test Passed", typeof(string));

            testResultsTable.Columns.Add("Test Result", typeof(string));

            testResultsTable.Columns.Add("Action", typeof(string));

            testResultsTable.Columns.Add("Explanation", typeof(string));

          ...

            DataTable testDataTable = new DataTable("TestData");

            dataSet.Tables.Add(testDataTable);

            testDataTable.Columns.Add("Output Name", typeof(string));

            testDataTable.Columns.Add("Test Name", typeof(string));

            testDataTable.Columns.Add("Test Data", typeof(string));

 

            var trtColumns = new DataColumn[] { testResultsTable.Columns["Output Name"], testResultsTable.Columns["Test Name"] };

            var tdtColumns = new DataColumn[] { testDataTable.Columns["Output Name"], testDataTable.Columns["Test Name"] };

            dataSet.Relations.Add("dataRelation",trtColumns, tdtColumns);





Attachment: Table_35e7fcc5.zip

3 Replies

MK Muthukumar Kalyanasundaram Syncfusion Team July 12, 2017 05:37 PM UTC

Hi Steve, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your query. We were unable to reproduce the reported “GridDataControl not showing parent & child relationship for tables” in our side. For your reference, we have attached the sample file in the below location. In the sample, we have loaded GridDataControl with relation of parent & child relationship. 
 
  
Could you please share some more information about your query as like,  
  1. For which scenario, you have get an error on you application.
  
If it’s possible, could you please revert by modifying the attached sample based on your application along with the replication procedure?. This would be helpful for us to provide an appropriate solution as soon as possible.   
 
Regards, 
Muthukumar K 



SM Steve McWilliams July 12, 2017 07:36 PM UTC

OK, I modified your sample solution to show the scenario that I think is wrong. You can see that the parent row for 'Output1 / txtName1' compound key shows child testData table rows for Output1/ txtName1, Output1/ txtName2 and Output1/txtName3.

I want parent row for Output1 and txtName1 to only show child row 'Output1 txtName1 data0'.

Right now, all three parent rows for Output1/ txtNameX   show all three child rows for Output1. It seems not to try and match on TestName column at all.


Attachment: Test_dc6f3e18.zip


MK Muthukumar Kalyanasundaram Syncfusion Team July 23, 2017 08:35 AM UTC

Hi Steve,  
 
Sorry for the delay. 
 
We were able to reproduce the issue and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates,  
 
 
Please let me know if you have any questions.  
 
Regards, 
Muthukumar K 



Loader.
Live Chat Icon For mobile
Up arrow icon