WCF load on demand but expand first level

3 posts, 0 answers
  1. BitShift
    BitShift avatar
    29 posts
    Member since:
    Aug 2014

    Posted 09 Sep 2014 Link to this post

    Im looking for a suggestion on how to cause the first node to show expanded.  Im using a WCF service with load-on-demand and that works fine.  Its just that the tree is completely collapsed and id like to cause the 1st level to be shown.  

    Ive thought about something like this.  Just look for the root node and cause expand it.
    The question then is ...where to do this from?  On page load?  
    http://www.telerik.com/help/aspnet-ajax/treeview-client-expand-parent-nodes.html
  2. BitShift
    BitShift avatar
    29 posts
    Member since:
    Aug 2014

    Posted 09 Sep 2014 Link to this post

    Oh, and I forgot to mention that the tree is inside an ajax panel
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. BitShift
    BitShift avatar
    29 posts
    Member since:
    Aug 2014

    Posted 09 Sep 2014 Link to this post

    Found a solution.  Just add a javascript handler on the tree itself for 'OnClientLoad'
    Something like this
                function pageTreeLoad(sender, eventArgs) {
                    var tree = $find("<%= MyTree.ClientID %>");
                    var node = tree.findNodeByText("Root Node Text Here...");
                    if (node != null) {
                        node.expand();
                    }

    this causes the WCF load on demand to fire and load the 1st level node list
                }
Back to Top