This is a migrated thread and some comments may be shown as answers.

ScrollIntoView When Finding Node

1 Answer 66 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Tahereh
Top achievements
Rank 1
Tahereh asked on 08 Jan 2011, 03:31 PM
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

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 10 Jan 2011, 01:45 PM
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.
Tags
TreeView
Asked by
Tahereh
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or