فتح مغلق

LeptonX Side Menu Selected Item #3935


User avatar
0
cellero خلقت
  • 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 إجابة (إجابات)
  • User Avatar
    0
    enisn خلقت
    فريق الدعم .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 خلقت

    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 v8.2.0-preview Updated on مارس 25, 2024, 15:11