Ends in:
1 DAY
21 HRS
13 MIN
45 SEC
Ends in:
1 D
21 H
13 M
45 S
Open Closed

LeptonX Side Menu Selected Item #3935


User avatar
0
cellero created
  • ABP Framework version: v6.0.0
  • UI type: Blazor Server

I have a high-level menu item that gives a list of items. Selecting an item goes into another razor page to display details. The details page is not an item on the side bar menu. My problem is that the initial menu item remains the "Selected" menu item and now menu item doesn't get the page again as it is already the selected item.

Question: How can I programmatically change the side bar menu so that no menu items are "Selected"?


2 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    PageLayout feature might help in your situation. https://docs.abp.io/en/abp/latest/UI/Blazor/Page-Layout

    • Inject PageLayout
        [Inject]
        public PageLayout PageLayout { get; set; }
    
    • Set MenuItemName as "none" and set it back empty after page is disposed.
    protected async override Task OnInitializedAsync()
    {
        PageLayout.MenuItemName = "None";
    }
    
    protected override void Dispose(bool disposing)
    {
        PageLayout.MenuItemName = string.Empty;
        base.Dispose(disposing);
    }
    
  • User Avatar
    0
    cellero created

    Thanks,
    PageLayout.MenuItemName = "None"; doesn't work. The active menu doesn't change.

    Instead, I used the same code but pointed to "MyProjectName.Home" menu and this worked.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35