Base solution for your next web application
Open Closed

Hide menu item if a feature is activated #12057


User avatar
0
gekko created

Hi, I have an application build with AspnetCore + JQuery.

I want to hide a menu item if a tenant has a certain feature activated. In other words, I want to show one menu item if the feature is activated, but show another menu item if the feature is not activated.

In AppNavigationProvicer.cs I can add Menuitems with "featureDependency". If the feature is activated, the menu item is shown, otherwise not. But I want also the opposite. Is that possible?

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think the easiest way is to create your custom https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/Application/Navigation/UserNavigationManager.cs, and in GetMenuAsync, you can use a similar method as default UserNavigationManager. Then, you can filter result of FillUserMenuItems to filter some of the menu items.

    Instead of extending UserMenuItem, you can define a different list which contains UserMenuItem and Feature pairs to hide some of the menu items.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    gekko created

    Hi, thank you, I will try it that way.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)