Starts in:
0 DAY
11 HRS
11 MIN
13 SEC
Starts in:
0 D
11 H
11 M
13 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 November 20, 2024, 13:06