More in this section

Forums / Developing with Sitefinity / TreeView expand top node by default

TreeView expand top node by default

2 posts, 1 answered
  1. Jeremy
    Jeremy avatar
    17 posts
    28 Jul 2010
    01 Sep 2010
    Link to this post
    I'd like to have the top node of a treeview control expanded by default when the page loads. Any way of doing this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    01 Sep 2010
    Link to this post
    Hi Jeremy,

    You can use js to do this.  Below is a sample code

    function onLoad(sender, eventArgs) {
            var zeroNode = sender.get_allNodes()[0];
            if (zeroNode.get_nodes().get_count() > 0) {

    <telerik:RadTreeview   OnClientLoad="onLoad" ID="RadTreeview1" runat="server" OnNodeDataBound="RadTreeview1_NodeBound"  OnDataBound="RadTreeview1_Bound" DataSourceID="SitemapDataSource1">

    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 1 answered