Treeview Load on demand & FindNodeByValue

3 posts, 1 answers
  1. Laurent Iltis
    Laurent Iltis avatar
    2 posts
    Member since:
    Jun 2009

    Posted 18 Jun 2009 Link to this post

    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. Answer
    Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 19 Jun 2009 Link to this post

    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.

    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.
  3. Laurent Iltis
    Laurent Iltis avatar
    2 posts
    Member since:
    Jun 2009

    Posted 19 Jun 2009 Link to this post

    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
Back to Top