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.
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