+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Multisite - hide menu node

Multisite - hide menu node

4 posts, 0 answered
  1. Liviu
    Liviu avatar
    6 posts
    Registered:
    03 Aug 2012
    14 Mar 2014
    Link to this post

    Hello,

    I have a multisite solution and for one of them i need my own node in menu added. As you can see in the attached menu (the new node is green colored).

    Is there any way to hide this node for the other site? What i want is when i switch to the other site, this node to be hidden.

    Thank you!

  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    18 Mar 2014
    Link to this post
    Hi Liviu,

    There is no such functionality, but you could try to do this by using code behind on the Dashboard Page (SitefinityWebApp.CurrentSite assembly) hiding that Page node:
    using System;
    using System.Linq;
    using Telerik.Sitefinity.Modules.Pages;
    using Telerik.Sitefinity.Pages.Model;
     
    namespace SitefinityWebApp
    {
        public class CurrentSite : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                var mySite = "MySite";
                var pageNode = "NodeNameToHide";
     
                var currentSite = new Telerik.Sitefinity.Multisite.MultisiteContext().CurrentSite.Name;
     
                if (currentSite != mySite)
                {
                    PageManager pageManager = PageManager.GetManager();
                    PageData page = pageManager.GetPageDataList().Where(pData => pData.Title == pageNode).FirstOrDefault();
                    page.NavigationNode.ShowInNavigation = false;
                    pageManager.SaveChanges();
                }
                else
                {
                    PageManager pageManager = PageManager.GetManager();
                    PageData page = pageManager.GetPageDataList().Where(pData => pData.Title == pageNode).FirstOrDefault();
                    page.NavigationNode.ShowInNavigation = true;
                    pageManager.SaveChanges();
                }
            }
        }
    }

    You could find video demonstration, how it works.

    Regards,
    Svetoslav Manchev
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Liviu
    Liviu avatar
    13 posts
    Registered:
    15 Feb 2012
    04 Apr 2014
    Link to this post

    Can you be a little more specific where this code shoud be added? SitefinityWebApp > Properties > AssemblyInfo.cs?

  4. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    06 Apr 2014
    Link to this post
    Hi Liviu,

    You need to create a class and than add it as code behind of the Backend pages under:
    Administration > Backend pages > (expand) Dashboard > Dashboard > Title & Properties > Code behind type (for ASP.NET developers) (example in case the .cs file is in the root folder of the project). 

    Add this code behind on 'Dashboard' and 'Pages' pages.

    Regards,
    Svetoslav Manchev
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 0 answered