radTreeview Looping

3 posts, 0 answers
  1. Kiran
    Kiran avatar
    6 posts
    Member since:
    May 2009

    Posted 08 Dec 2009 Link to this post

    Hi All,

    I am facing a problem while looping through the radtreeview.

    My radtreeview structure is as below:

    folder A
         folder B
                 folder C
    Folder D
          Folder E
                 Folder F
                          Folder G
                                  ---------------------N Number of childs
    Now i want to loop through the radtreeview,how can i get this? I want some generalised function that will loop through radtreeview.

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Dec 2009 Link to this post

    Hello Kiran,

    You can access all the nodes in the RadTreeView using following code.

    CS:
     
        protected void Button1_Click(object sender, EventArgs e) 
        { 
            showAllNodes(); 
        } 
        public void showAllNodes() 
        { 
            foreach (RadTreeNode node in RadTreeView1.GetAllNodes()) 
            { 
                Response.Write(node.Text); 
            } 
            RadTreeNode lastNode = (RadTreeNode) RadTreeView1.GetAllNodes()[RadTreeView1.GetAllNodes().Count-1]; 
            Response.Write("  Last Node text :" + lastNode.Text); 
        } 

    -Shinu.
  3. Kiran
    Kiran avatar
    6 posts
    Member since:
    May 2009

    Posted 08 Dec 2009 Link to this post

    Hi Shinu,

    Thanks for the reply..

    It really helped me in solving the problem.

Back to Top