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

RadTreeView expanding nodes

5 Answers 164 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Graham
Top achievements
Rank 1
Graham asked on 07 Jul 2012, 01:59 AM
I have a RadTreeView which is defined thus:

<telerik:RadTreeView ID="radTreeView" runat="server" Width="100%" EnableDragAndDrop="true" EnableDragAndDropBetweenNodes="true"

OnNodeClick="radTreeView_OnNodeClick" OnClientNodeCollapsing="OnClientNodeCollapsing"

OnNodeDrop="radTreeView_OnNodeDrop">

 

<WebServiceSettings Path="BuildTrgMP.aspx" Method="GetChildNodes" />

 

</telerik:RadTreeView>

I have a web service method which populates the tree when nodes are clicked.
The page in question accepts an id in the query string and the id represents the Value of a node in the tree which can be any node in the tree.
The idea is that when the page starts, the user is placed in the tree with the tree expanded and the node with the parameter id selected.
The problem is that there seems to be a conflict between nodes loaded client side by the webservice and nodes loaded server side in page load ie doing expands and searches for nodes server side doesn't find anything because they haven't been loaded client side.
If I code to populate the heirarchy server side in Page_Load, when the page appears, no nodes are expanded, although if I expand them, I come to my selected node. It almost as if having webservice loading conflicts with server side loading.

So to get back to the requirements:
- I have a tree which loads branches using the webservice 
- When the page loads, in Page_Load I want to be able to set a currently selected node (which can be anywhere in the tree and at any level) and I want the tree hierarchy to it to be expanded (all other paths can be collapsed)

How do I do it please ?

Thanks + regards

Graham Plowman

5 Answers, 1 is accepted

Sort by
0
Graham
Top achievements
Rank 1
answered on 11 Jul 2012, 11:59 AM
Anyone got any suggestions ?

Thanks

Graham Plowman
0
Plamen
Telerik team
answered on 11 Jul 2012, 02:15 PM
Hello Graham,

 
Such functionality is not supported when RadTreeView loads on demand from Web Service because the nodes are no loaded at that moment. 

Regards,
Plamen
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.
0
Graham
Top achievements
Rank 1
answered on 12 Jul 2012, 02:15 AM
Thanks Plamen.

How would we then have the tree load nodes as they are clicked, rather than doing a full load and at the same time, have the ability to set the currently selected node ?

It seems that a new feature is required that effectively 'posts' from server to client side to tell the client to expand a node hierarchy (using the web service) and then set the current item ?

From JavaScript, is it possible to tell a node to expand itself using the web service ? 
0
Plamen
Telerik team
answered on 16 Jul 2012, 03:15 PM
Hi Graham,

 
Thank you for your recommendation and for sharing your opinion.

Currently such functionality is not implemented indeed but we will spend some time to inspect possible ways of achieving it and  if we find out a workaround we will share it in this thread.

Regards,
Plamen
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.
0
Plamen
Telerik team
answered on 20 Jul 2012, 08:43 AM
Hello Graham, 

I am attaching a sample project where the expanded state and the selected node persist after the post back by saving the hierarchical index of the clicked not in a cookie similar to what is done in this Code Library.

Hope this will be helpful.
 

Greetings,
Plamen
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.
Tags
TreeView
Asked by
Graham
Top achievements
Rank 1
Answers by
Graham
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or