RadTreeView Node Refresh

3 posts, 0 answers
  1. DEBAL
    DEBAL avatar
    22 posts
    Member since:
    Oct 2012

    Posted 16 Mar 2012 Link to this post

    Hi Support
    I'm using Telerik Rad Tree View for one of my asp.net application, my requirement is that :
    There a Refresh Button in my telerik radpane container  .
    User click on the nodes of tree view and different pages are open for that .
    After they click on refresh button ( note : refresh button click because user can right click on any child node and create new node after that) I want to show user the last node where user was there (means from parent node to child node should remain expanded but other nodes that user did not click should closed, if click then expanded )  before click on refresh button .

    How Can I do that , pl any suggestion
  2. Plamen
    Plamen avatar
    2810 posts

    Posted 21 Mar 2012 Link to this post

    Hi Debal,

    You can refer to the Save the expanded state of the TreeNodes when the treeview is being bound upon each postback Code Library and use a similar code to save the state of the node that you need in your scenario.

    Hope this will be helpful.

    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DEBAL
    DEBAL avatar
    22 posts
    Member since:
    Oct 2012

    Posted 22 Mar 2012 Link to this post

    Thanks for your reply ,
    I have Solved my problem like below simple  steps .
    First I mentioned that , I have a refresh button ,  When user click on refresh button the node should expand where the user was there , I tried to do this by following code ... it is working .......

    I write a filed first :

    private string selectednode;

    In Page_Load I want to store the value of Selected node in the variable :

    if(this.treeview1.SelectedNode != null)
        selectednode = this.treeview1.SelectedNode.Value ;

    Second In the click event of Button refresh :

    private void btnRefresh_Click(Object Sender , EventArgs e)
       LoadTreeView(listofnodes); // this method call database and load all treeview nodes......this is not explained here.

    Lastly ,

    private void LastTreeNode()
     RadTreeNode node = this.treeview1.FindNodebyValue(selectednode);

    if(node != null)
     if(node.ParentNode.value != string.Empty || node.ParentNode.value != null)
                 RadTreeNode node1 = node.ParentNode;
                 node1.Selected = true;

    This is upto now I have done ..... pl help me someone to improve this code with better suggestion.
Back to Top