RadTreeView expanding nodes

6 posts, 0 answers
  1. Graham
    Graham avatar
    28 posts
    Member since:
    Feb 2011

    Posted 06 Jul 2012 Link to this post

    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

  2. Graham
    Graham avatar
    28 posts
    Member since:
    Feb 2011

    Posted 11 Jul 2012 Link to this post

    Anyone got any suggestions ?

    Thanks

    Graham Plowman
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 11 Jul 2012 Link to this post

    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.
  5. Graham
    Graham avatar
    28 posts
    Member since:
    Feb 2011

    Posted 11 Jul 2012 Link to this post

    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 ? 
  6. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 16 Jul 2012 Link to this post

    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.
  7. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 20 Jul 2012 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017