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

dataset.Addrange()

Thread ID:

Created:

Updated:

Platform:

Replies:

117521 Nov 3,2014 07:31 AM UTC Nov 6,2014 02:33 PM UTC WinForms 3
loading
Tags: GridGroupingControl
Rasika
Asked On November 3, 2014 07:31 AM UTC

Hi,
I am using Gridgrouping control.
I have parent-child relationship in my gridgrouping control.
First time it works fine but when I create relation for another row then
 

ds.Tables.AddRange(new DataTable[]{parenttable,childtable})

method gives me the error of "Datatable 'Table1' is already belongs to this dataset".

Please give me any solution regarding to this.

Regards,

Rasika


Muthukumar Kalyanasundaram [Syncfusion]
Replied On November 4, 2014 02:18 PM UTC

Hi Rasika,

 

Thank you for your interest in Syncfusion products.

 

We would like to let you that at first  you can added all table to the dataSet, then relations between the tables are made and added to the dataSet. The dataSet is then assigned as the datasource of the grid. The GridGroupingControl itself creates the nested structure of the tables directly from the information in the dataset. Please refer the below code,

 

Code:

 

DataTable parentTable = GetParentTable();

DataTable childTable = GetChildTable();

DataTable grandChildTable = GetGrandChildTable();

DataSet ds = new DataSet();

ds.Tables.AddRange(new DataTable[] { parentTable, childTable, grandChildTable });

DataRelation parentToChild = new DataRelation("ParentToChild", parentTable.Columns["parentID"], childTable.Columns["ParentID"]);

DataRelation childToGrandChild = new DataRelation("ChildToGrandChild", childTable.Columns["childID"], grandChildTable.Columns["ChildID"]);

ds.Relations.AddRange(new DataRelation[] { parentToChild, childToGrandChild });

this.gridGroupingControl1.DataSource = parentTable;

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: Parent__Child_relation_61025470.zip

Rasika
Replied On November 5, 2014 12:10 PM UTC

Hello Muthukumar Kalyanasundaram ,

Thank You!

It works as expected.

Regards,
Rasika

Muthukumar Kalyanasundaram [Syncfusion]
Replied On November 6, 2014 02:33 PM UTC

Hi Rasika

 

We are glad to hear that the reported issue has been resolved. Please let us know if you need any further assistance.

 

Regards,

Muthukumar K


CONFIRMATION

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.

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

;