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

Set Navigation Item #1098


User avatar
0
tk76 created

Hi

How can I set the active navigation item manually, at the moment it is only active if the user is on the page defined in the navigation menu class. However I need to also display that navigation item for other pages?


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

    It will change based on your architecture. Do you use SPA or MPA?

  • User Avatar
    0
    tk76 created

    Hi

    I am using MPA, and cannot figure out how to set it manually.

    Can you help?

    Thanks in advance.

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    You can highlight any menu item by setting ViewBag.CurrentPageName to related menu's name. Example:

    <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Web/Areas/Mpa/Views/Languages/Texts.cshtml#L5">https://github.com/aspnetzero/aspnet-ze ... .cshtml#L5</a>

    This page is used to edit texts of a specific language, but it highlights languages menu item (which is actually clicked to see list of all languages).