Multisite - hide menu node

Posted by Community Admin on 04-Aug-2018 10:07

Multisite - hide menu node

All Replies

Posted by Community Admin on 14-Mar-2014 00:00

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!

Posted by Community Admin on 18-Mar-2014 00:00

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
 

Posted by Community Admin on 04-Apr-2014 00:00

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

Posted by Community Admin on 06-Apr-2014 00:00

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
 

This thread is closed