Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity 2.x: Deployment > Site map control question

Site map control question

  • G avatar

    Posted on Oct 30, 2008 (permalink)

    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?

    Reply

  • Pepi Pepi admin's avatar

    Posted on Oct 31, 2008 (permalink)

    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.

    Reply

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity 2.x: Deployment > Site map control question