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

add custom controle in child node.

Thread ID:

Created:

Updated:

Platform:

Replies:

121548 Dec 29,2015 11:00 AM UTC Dec 31,2015 09:57 AM UTC WinForms 3
loading
Tags: TreeViewAdv
Rasika
Asked On December 29, 2015 11:00 AM UTC

hi,
I am using syncfusion TreeViewAdv controle where i have four Parent node ,then each parent node have about 30 child node.
now i want to add separate Gridgrouping control  with datasource as datatable as custom control to every child node.
also i want to retreive  table binded to  perticular child node.
is there any solution please provide me in detail.
thanks.

Senthil Kumaran Rajan [Syncfusion]
Replied On December 30, 2015 06:33 AM UTC

Hi Rasika,

Thank you for using Syncfusion products.

The reported requirement can be achieved by using Custom control property in TreeNodeAdv. Please refer the below code example. 

Code Snippet[C#]:

int i = 0;
int TotalNodeCount = 4;
//To add the Parent node
for (i = 0; i < TotalNodeCount; i++)
     {
           TreeNode = new TreeNodeAdv();
           TreeNode.Text = "node" + nodenumber.ToString();
           nodenumber++;
           this.treeViewAdv1.Nodes.Add(TreeNode);
      }
 
     //To Add child node
     foreach (TreeNodeAdv node in this.treeViewAdv1.Nodes)
     {
         for (int childnode = 0; childnode <= 30; childnode++)
            {
                TreeNode = new TreeNodeAdv();
                TreeNode.Text = "node" + nodenumber.ToString();
                nodenumber++;
                node.Nodes.Add(TreeNode);
            }
     }
 
     for (int addcustom = 0; addcustom < 4; addcustom++)
     {
           //To add the GridGrouping Control.
           foreach (TreeNodeAdv node in Collect(this.treeViewAdv1.Nodes[addcustom].Nodes))
           {
                GridGroup = new GridGroupingControl();
 
                GridGroup.GridVisualStyles = GridVisualStyles.Metro;
                GridGroup.TopLevelGroupOptions.ShowCaption = false;
                if (node.CustomControl == null)
                  {
                      node.CustomControl = GridGroup;
                      GridGroup.DataSource = dt;
                      node.CustomControl.Width = 300;
                      node.Height = 80;
                   }
            }
     }


We have also prepared a sample for your reference and it can be downloaded from here.

Sample : http://www.syncfusion.com/downloads/support/forum/121548/ze/TreeCustom-1374470462

Please refer the below Knowledge Base to add the custom control in TreeViewAdv.

KB Link : http://www.syncfusion.com/kb/4666/how-to-add-custom-controls-in-treeviewadv

Please let us know if you need further assistance.

Regards,
Senthil.


Rasika
Replied On December 30, 2015 07:15 AM UTC

thanks for reply.
your solution works for me.
but now i want to retreive datatable bind to  ggc of perticular child node of corresponding parent node in treeviewadv.
is there any solution to achieve this.

regards,
Rasika.

Senthil Kumaran Rajan [Syncfusion]
Replied On December 31, 2015 09:57 AM UTC

Hi Rasika,

 

Thanks for contacting Syncfusion Support.

 

The DataTable can be retrieved from GridGroupingControl which is loaded as custom control for TreeNodeAdv, by using the below code example.

 

Code Example[C#]:

 

if (this.treeViewAdv1.SelectedNode != null && this.treeViewAdv1.SelectedNode.CustomControl != null)
            {
                //To get the DataTable from GridGroupingControl.
                foreach (DataRow dr in ((this.treeViewAdv1.SelectedNode.CustomControl as GridGroupingControl).DataSource as DataTable).Rows)
                {
                    //To get the Row value from DataTable.
                    this.listBox1.Items.Add(dr["FirstName"].ToString());
                }
            }
 

 

We have prepared a sample and video for your reference and it can be downloaded from the following location.

 

Sample : http://www.syncfusion.com/downloads/support/forum/121548/ze/TreeCustom-571415503

 

Video : http://www.syncfusion.com/downloads/support/forum/121548/ze/CustomControlNode-1810720342

 

Regards,

Senthil


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

;