This is a migrated thread and some comments may be shown as answers.

Only Refresh Parent Node and Selected Child Node

5 Answers 294 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
AL
Top achievements
Rank 1
AL asked on 17 Jul 2009, 08:05 PM

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!!!

5 Answers, 1 is accepted

Sort by
0
AL
Top achievements
Rank 1
answered on 20 Jul 2009, 02:08 PM
Can anyone HELP me with this please! or this is not possible?
0
Atanas Korchev
Telerik team
answered on 20 Jul 2009, 02:20 PM
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.
0
AL
Top achievements
Rank 1
answered on 20 Jul 2009, 02:29 PM
OK, then how to refresh (update) the whole control (treeview) and THEN display the expanded parent node and child node?
0
Mr. Plinko
Top achievements
Rank 1
answered on 20 Jul 2009, 09:27 PM
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
0
AL
Top achievements
Rank 1
answered on 22 Jul 2009, 01:47 PM
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
Tags
TreeView
Asked by
AL
Top achievements
Rank 1
Answers by
AL
Top achievements
Rank 1
Atanas Korchev
Telerik team
Mr. Plinko
Top achievements
Rank 1
Share this question
or