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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Nested Child-Collection example in dashboard. How to add nested child table programmatically?

Thread ID:

Created:

Updated:

Platform:

Replies:

124218 May 24,2016 10:15 PM May 25,2016 10:36 AM Windows Forms 1
loading
Tags: GridGroupingControl
Paul Chung
Asked On May 24, 2016 10:15 PM

Hi,

I am using the GridGroupingControl that works similar as the Nested Child-Collection example in the winform dashboard.

I couldn't find a way to programmatically add a child table after the data source is bound.

Here is my example modification from the "Nested Child-Collection example",

First I modify the BaseClassList to BindingList so that it supports update

public class BaseClassList : BindingList<BaseClass>, ITypedList

In the Form1 constructor, after 

            _gridGroupingControl1.DataSource = theList;

I added these to just test programmatically changing the list.

            Action mystuff = () =>
            {
                var list = new BaseClassList();
                for (int i = 0; i < 5; i++)
                    list.Add(new SecondClass(theList[0], i, "myItem" + i));
                theList[0].ChildTables.Add("XXXXChild_Of_List0", list);
            };

            Thread tt = new Thread(() => {
                Thread.Sleep(3000);
                _gridGroupingControl1.Invoke(mystuff);
            });
            tt.Start();


There is no effect after few seconds. 
I also tried unbind the data source and bind it again it still doesn't work.


Adhikesevan Kothandaraman [Syncfusion]
Replied On May 25, 2016 10:36 AM

Hi Paul, 

Thanks for using Syncfusion products. 

If you want to add the additional child table on runtime, please reset the Datasource of the GridGroupingControl and then set the updated source to the grid. Please refer to the following code snippet, 

Code Snippet: 
var list = new BaseClassList(); 
for (int i = 0; i < 5; i++) 
    list.Add(new SecondClass(theList[0], i, "myItem" + i)); 
theList[0].ChildTables.Add("NewChild", list); 
 
this.gridGroupingControl1.DataSource = null; 
//Set the updated source to the Grid 
this.gridGroupingControl1.DataSource = theList; 
 
this.gridGroupingControl1.Refresh(); 
 
 
Sample Link: 


Regards, 
Adhi 


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

;