custom navigation template

Posted by Community Admin on 04-Aug-2018 11:42

custom navigation template

All Replies

Posted by Community Admin on 06-Feb-2013 00:00

Hi all,

I wrote custom navigation template. In code behind, 'SiteMapNavigationTreeView' control was binded. If a page ShowInNavigation flag's 'false', don't want to show in navigation. If sitemap depth bigger than 2, It cause problem. How to unvisible?

Here is my .cs code :

 protected void Page_Load(object sender, EventArgs e)
          
        SiteMapNode smn = SiteMapBase.GetCurrentProvider().CurrentNode;

        while (smn.ParentNode != null)
       
            if (smn.ParentNode.ParentNode == SiteMap.RootNode)
             
                siteMapControl_verticaltree.DataSource = getNodes(smn);
                siteMapControl_verticaltree.DataBind();
              
                break;
           

            smn = smn.ParentNode;
       
   

    protected SiteMapNodeCollection getNodes(SiteMapNode smn)
   
        SiteMapNodeCollection col = new SiteMapNodeCollection();

        for (int i = 0; i < smn.ParentNode.ChildNodes.Count; i++)
       
            if (((Telerik.Sitefinity.Web.PageSiteNode)(smn.ParentNode.ChildNodes[i])).ShowInNavigation)
           
                col.Add(smn.ParentNode.ChildNodes[i]);
           
       

        return col;
   

---------------------------------------------------------------------------------
asp.x

 <sf:ConditionalTemplate ID="ConditionalTemplate8" Left="NavigationMode" Operator="Equal"
            Right="VerticalTree" runat="server">
            <navcontrols:SiteMapNavigationTreeView runat="server" ID="siteMapControl_verticaltree"
                Skin="Sitefinity">
            </navcontrols:SiteMapNavigationTreeView>
        </sf:ConditionalTemplate>
-----------------------




Posted by Community Admin on 08-Feb-2013 00:00

Hello Özkan,

My recommendation would be to use SitefinitySiteMapDataSource, because it's based on asp.net SiteMapDataSource, and it also handles the information about permissions applied to pages, their ShowInNavigation property and culture. It will always return the correct pages.

Greetings,
Randy Hodge
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed