More in this section
Forums / Deployment / Site map control question

Site map control question

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. G
    G avatar
    1 posts
    Registered:
    30 Oct 2008
    30 Oct 2008
    Link to this post
    I would like to have all the site map nodes open on the page by default. Can't seem to find a setting for this. Is there one?
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    31 Oct 2008
    Link to this post
    Hello G,

    You could create a javascript function that represents a handler of OnClientLoad event. It will retrieve all the nodes for the RadTreeView, iterate the nodes and expand those with children. The described functionality should be implemented in ~/Sitefinity/Admin/ControlTemplates/Pages/SiteMapPanel.ascx template like this:

    <script language="javascript" type="text/javascript"
     function onLoad(sender, eventArgs)           
        var nodes = sender.get_allNodes(); 
         
        for (var i=0; i < nodes.length; i++) 
        { 
           if (nodes[i].get_nodes() != null) 
           { 
               nodes[i].expand(); 
           } 
        }          
    }                   
             
    </script> 
     
    <asp:LinkButton ID="createBtn" CommandName="New" CssClass="CmsButLeft new" runat="server"
        <strong class="CmsButRight light"><asp:Literal runat="server" Text="<%$Resources:CreateAPage %>"></asp:Literal></strong
    </asp:LinkButton> 
    <h2 id="sitemap"><asp:Literal runat="server" Text="<%$Resources:SiteMap %>"></asp:Literal></h2
    <div class="sitemapTree"
    <telerik:RadTreeView ID="SiteNavigation" OnClientLoad="onLoad" EnableEmbeddedSkins="false" Skin="SitefinitySiteMap"  EnableDragAndDropBetweenNodes="true" runat="server" Width="190"></telerik:RadTreeView></div

    Do let us know if this helps.

    All the best,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
2 posts, 0 answered