How do I find a TreeNode that has a certain value, and append ChildNodes?

Posted on 2007-07-23
Last Modified: 2012-05-05
I have a TreeView with a root TreeNode in it already. In my code-behind, I want to take that existing TreeNode, go to a treenode that has a value of "C:\\Temp\first\folder1", then add a childnode underneath it using this.ChildNodes.Add(newTreeNode). How do I find the node with a value of "xxxx"? I'm using ASP.NET 2.0 / C#.
Question by:bemara57
    LVL 4

    Accepted Solution


    Use the FindNode method of the TreeView

    Something like:
    TreeNode node = TreeView1.FindNode(myFolderPath);

    Here is the documentation from Microsoft:
    LVL 4

    Expert Comment


    The second part of your question:

    To add a child node do the following:


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video discusses moving either the default database or any database to a new volume.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now