Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Define a new MenuDefinition in addition to MainMenu #190


User avatar
0
behiunforgiven created

How Can I define a new MenuDefinition in addition to MainMenu? I want to create a separate menu in sidebar

In my NavigationProvider i create it by this code

context.Manager.Menus.Add("SideBarMenu",
                new MenuDefinition(
                    "SideBarMenu",
                    new LocalizableString("SideBaeMenu", EPEDCConsts.LocalizationSourceName))
                    );

but i can't use it and add MenuItems!


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    In C#, inject IUserNavigationManagerand use GetMenuAsync("SideBarMenu", ...). Second parameter can be current user id or null (see <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp/Application/Navigation/IUserNavigationManager.cs">https://github.com/aspnetboilerplate/as ... Manager.cs</a>).

    In javascript, you can get it using abp.nav.menus.SideBarMenu

  • User Avatar
    0
    behiunforgiven created

    Thank you, but how can I add items to my "SideBarMenu" ?

  • User Avatar
    0
    hikalkan created
    Support Team

    You should simple add items to the MenuDefinition object before passing it to context.Manager.Menus.Add method. Nothing special here.

    Thanks.