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

[Solved] Treeview Load on demand & FindNodeByValue

2 Answers 154 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Laurent Iltis
Top achievements
Rank 1
Laurent Iltis asked on 18 Jun 2009, 01:07 PM
Hello, I'm new user of Telerik and it's the first time I write a message here.

I have a RadTreeView which is loaded with "Load on demand" method (with SQL query) And I want to use a search field ID to expand the treeview on the result node.
I use the FindNodeByValue method (server-side) to do this but I have a problem.
When I click on the search button which fire this method, it return null value because it don't find de corresponding node.
but when I click after have expanded and collapsed nodes of the treeview, this method works well and I retrieve the good node by the value.

I understand that when I expand the nodes (manually with the mouse), they are loaded in memory and the method FindNodeByValue works but If I don't do this, it not works.

Thanks you very much for your help.

Info : I use ServerSideCallBack as expandmode

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 19 Jun 2009, 09:02 AM
Hello Laurent Iltis,

Since you are using load-on-demand the child nodes are not loaded until the parent node is expanded. Thus the treeview does not know initially which are the child nodes and cannot find the node you are searching for.

One solution would be to search for the given string in the database and if you find a record, get all the parent records and create the respective nodes manually.

Regards,
Veselin Vasilev
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
Laurent Iltis
Top achievements
Rank 1
answered on 19 Jun 2009, 09:30 AM
Thank you very much Veselin,
Effectively, I've created a SQL search query and when it finds record, I store the full path in a Stack object (LIFO).
Then, I populate the nodes which are in this stack coupled whith FindSearchByValue method (to use the nodes of my treeview and not create new).
It works fine ;-)

Thank you for your support
Tags
TreeView
Asked by
Laurent Iltis
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Laurent Iltis
Top achievements
Rank 1
Share this question
or