Recursive tree treelist

Source: Internet
Author: User

<summary>
Enumerates all the nodes in the tree.
</summary>
<param name= "Tree" ></param>
<returns></returns>
Public IList getchecknodes (treelist tree)
{
Used to store the selected nodes.
IList list = new ArrayList ();
The head loop gets the selected root node.
foreach (Treelistnode n in tree. Nodes)
{
if (n.checked) list. ADD (New Mynodeitem (n, "root directory")); Checked indicates that the check box
if (n.checked)
{
List. ADD (n); Checked indicates that the check box
Break
}
If the current node has a child node set, then all child nodes are enumerated.
if (N.nodes.count > 0)
This. Dogetchecknodes (list, n);
}
return list;
}
<summary>
Shave, scan all nodes.
</summary>
<param name= "List" ></param>
<param name= "ParentNode" ></param>
private void Dogetchecknodes (IList list, Treelistnode parentnode)
{
Enumerates all child nodes of the current node
foreach (Treelistnode n in Parentnode.nodes)
{
if (n.checked)
{
List. ADD (n);
Break
}
If the current node has a child node set, then all child nodes are enumerated.
if (N.nodes.count > 0)
This. Dogetchecknodes (list, n);
}
}

Recursive tree treelist

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.