ScrollIntoView When Finding Node

2 posts, 0 answers
  1. Tahereh
    Tahereh avatar
    3 posts
    Member since:
    Dec 2010

    Posted 08 Jan 2011 Link to this post

    HI
    I have a RadTreeView inside RadAjaxPanel, I also have a textbox and button inside AjaxPanel, when the user clicks the button, Server side method executes and find appropriate node according to the text in textbox and select the first item.I want to scroll to selected node and I use ScrollIntoView with the following format:

    <script type="text/javascript">
    function OnResponseEnd(sender, arguments)
    {
          var treeviewInstance = <%=RadTreeView1.ClientID %>;
          var selectedNode = treeviewInstance.SelectedNode;
           if (selectedNode != null)
           { 
              selectedNode.ScrollIntoView();
           }
    }
    </script>

    <radA:RadAjaxPanel
        ID="RadAjaxPanel1"
        runat="server"
        ClientEvents-OnResponseEnd="OnResponseEnd">
    </radA:RadAjaxPanel>

    But it doesn't work and it can not find treeviewInstance.SelectedNode. What should I do?

    Thanks In Advance
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 10 Jan 2011 Link to this post

    Hello Tahereh,

    Please make sure the TreeView has set Height and that the Node is visible before calling ScrollIntoView(). Additionally you can try to call the method with a timeout:
    setTimeout(function() {selectedNode.ScrollIntoView();}, 0);

    I hope this helps.

    All the best,
    Simon
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top