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

How can i get checked Nodes and Child nodes separately using Treeviewadv into different lists??

i tried with this code.. 
i'm getting all the nodes which are checked into one list...
List<String> aResult = new List<String>();
            foreach (Syncfusion.Windows.Forms.Tools.TreeNodeAdv aNode in treeViewAdv1.Nodes)
                {
                    if (aNode.Checked)
                    {
                        aResult.Add(aNode.Text);
                    }
                    aResult.AddRange(CheckedNames(aNode.Nodes));
                }

1 Reply

SK Senthil Kumaran Rajan Syncfusion Team June 10, 2014 10:30 AM UTC

Hi Narry,

 

Thank you for using Syncfusion Product,

 

We would like to let you know that your requirement in "Treeviewadv" can be achieved by creating another list. In the sample provided, we have found that only a single list has been maintained due to the nodes which have been  checked into that list. We have prepared a sample to achieve your query. Please have the sample attached below.

  

Code Snippet[C#] : To get a child node in the list.

 

  List<String> child = new List<String>();

  for (int n = 0; n < treeViewAdv1.Nodes.Count; n++)

                {

                    foreach (TreeNodeAdv childnode in treeViewAdv1.Nodes[n].Nodes)

                    {

                        if (childnode.Checked)

                        {

                            child.Add(childnode.Text);

                        }

                    }

                }            

 

 

Please let us know if you have any concerns,

 

Regards,

Senthil kumaran
Attachment: tree1_9b1a0d79.zip

Loader.
Live Chat Icon For mobile
Up arrow icon