Only Refresh Parent Node and Selected Child Node

6 posts, 0 answers
  1. AL
    AL avatar
    40 posts
    Member since:
    May 2008

    Posted 17 Jul 2009 Link to this post

    Hi,

    I have splitter in an aspx page (this aspx page does inherit a Master Page). This splitter has a LEFT Pane and a RIGHT Pane. The Left Pane has a TREE, the contents of this TREE are populated from database. This TREE has Parent Nodes and Child Nodes. On clicking the Parent nodes their child nodes are displayed.  NOW clicking the child nodes will open an aspx page in the RIGHT Pane. Basically the child nodes contain NavigationUrl, so that when a user clicks it, an aspx page is opened in the RIGHT pane.

    Now regarding RIGHT pane: User types data in textboxes, text area… There is also a SAVE button in the aspx page that was loaded in the RIGHT Pane.

    When User clicks the SAVE button in the Right Pane, I want Only that Parent Node and THAT Clicked Child NODE to be refreshed, NOT the entire tree.

    Can anyone HELP, PLEASE!!!

  2. AL
    AL avatar
    40 posts
    Member since:
    May 2008

    Posted 20 Jul 2009 Link to this post

    Can anyone HELP me with this please! or this is not possible?
  3. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Jul 2009 Link to this post

    Hello AL,

    Unfortunately you cannot refresh just portions of a web control by using Ajax. The whole control (treeview) must be updated in order to work properly.

    Regards,
    Albert
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. AL
    AL avatar
    40 posts
    Member since:
    May 2008

    Posted 20 Jul 2009 Link to this post

    OK, then how to refresh (update) the whole control (treeview) and THEN display the expanded parent node and child node?
  5. Mr. Plinko
    Mr. Plinko avatar
    56 posts
    Member since:
    Jul 2009

    Posted 20 Jul 2009 Link to this post

    I've been looking at the TreeView documentation, and I found a couple things that may or may not be of help to you. Let me know.

    For scrolling to a node when a page loads:
    http://www.telerik.com/help/aspnet-ajax/tree_nodescrolling.html
    This might be helpful if you can get the page to refresh after saving.

    Then there is the Load On Demand feature that can either be Client Side, Server Side, Web Service, and Page Methods.
    There is a Demo here:
    http://www.telerik.com/help/aspnet-ajax/tree_databindingloadondemandserver.html


    Here is some more info on Load On Demand, if it seems helpful.
    Refresh Node on Demand:
    http://www.telerik.com/help/aspnet-ajax/treeview-how-to-refresh-nodes-added-on-demand.html
    Server Side Load On Demand
    http://www.telerik.com/help/aspnet-ajax/tree_databindingloadondemandserver.html
  6. AL
    AL avatar
    40 posts
    Member since:
    May 2008

    Posted 22 Jul 2009 Link to this post

    Ok, I searched and searched and searched.....and found the correct solution here, and it was quiet simple and up to the point:

    http://www.telerik.com/help/aspnet/treeview/tree_navigateurl.html




    The state is not persisted after URL navigation

    When the page is redirected by using the NavigateUrl property of the RadTreeNode class, the state of the treeview is not persisted. Actually, this behavior is typical for all APS.NET controls. If you need, however, to retain the expanded TreeNodes after the URL navigation, you can use the approach described below:

    Example:

    Consider the following scenario:

    All nodes have unique Value properties (i.e 1,2,3...). They also have unique NavigateUrl properties pointing to one page but with different id Get parameter, i.e ( "?Page.aspx&id=1", "?Page.aspx&id=2" ..)

    In the Page_Load method of the page you can get the id attribute from the query string, find the node in the tree and mark it as selected and expand nodes up the tree, e.g.

    C# Copy Code
    if (Request.QueryString["id"] != null)
    {
         
    string id = Request.QueryString["id"];
         
    foreach (RadTreeNode node in RadTree1.GetAllNodes())
         {
               
    if (node.Value == id)
               {
                     node.ExpandParentNodes();
                     node.Selected = true;
               }
         }
    }



    Thanks Mr. Plinko for your efforts
Back to Top