Scrolling to the selected node
HOW-TO
Scroll to a node
SOLUTION
If you need to scroll to a certain node you can use a simple JS code to do so. The example below shows how to scroll the the selected node upon page_load:
| <script language="javascript"> |
| function pageLoad() |
| { |
| var tree = $find("<%=RadTreeView1.ClientID %>"); |
| var selectedNode = tree.get_selectedNode(); |
| if (selectedNode) |
| { |
| selectedNode.scrollIntoView(); |
| } |
| } |
| </script> |
| <body onload="setTimeout('ScrollToSelectedNode()', 20);"> |
| ... |
| <script language="javascript"> |
| function ScrollToSelectedNode() |
| { |
| var tree = <%=RadTreeView1.ClientID %> |
| var selectedNode = tree.SelectedNode; |
| if (selectedNode != null) |
| { |
| selectedNode.ScrollIntoView(); |
| } |
| } |
| </script> |
| ... |
| </body> |
| |
| |
Comments
If you'd like to comment on this KB
article, please, send us a
Support Ticket.
Thank you!
Please
Sign In
to rate this article.