scroll the page to the selected node

2 posts, 0 answers
  1. Mehrdad
    Mehrdad avatar
    9 posts
    Member since:
    Mar 2009

    Posted 10 Mar 2009 Link to this post

    Hi,
    I have a treeview on my page and I have a clientside search on it.
    My tree height is longer that the page, now if a node be found on bottom of page and I select it, now how can I scroll the page to appear the slected node
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Mar 2009 Link to this post

    Hi Mehrdad,

    One suggestion is by setting the height of the RadTreeView so that scrollbars for RadTreeview will appear and using the following client sde code for scrolling to the selected node.

    JavaScript:
    <script type="text/javascript">  
    function find()  
    {  
       var tree= $find("<%= RadTreeView1.ClientID %>");  
       var Node = tree._findItemByText("FindMe"); // Get the node  
       if (Node != null)  
       {  
         Node.select();  //Select the node  
         Node.scrollIntoView(); // Scroll to the selected node  
       }  
    }  
    </script> 

    Thanks,
    Princy.
Back to Top