Here, we'll discuss our sidebar menu/Navigation menu. We'll describe every method of our menus. Let's deep dive into it.
We have two types of menus for two different layouts.
We are using a .cshtml file to store all menus list and render it in our menus. You can find these menu files in the /Views/Shared/Sections/Menu/
folder.
TestController
, But simply use Test
as the controller name for the route.
To add your new menu item in menu/navigation, you need to add your page details in your preferred menu file (ex: For vertical menu, _VerticalMenu.cshtml).
<li class='menu-item@(currentPage == "/Test/TestPage" ? " active" : "")'>
<a asp-controller="Test" asp-action="TestPage" class="menu-link">
<i class="menu-icon tf-icons bx bx-home-alt"></i>
<div data-i18n="TestPage">TestPage</div>
</a>
</li>
<ul class="menu-sub">
<li class='menu-item@(currentPage == "/Test/TestPage" ? " active" : "")'>
<a asp-controller="Test" asp-action="TestPage" class="menu-link">
<div data-i18n="TestPage">TestPage</div>
</a>
</li>
</ul>
<li class='menu-item@(currentPage.StartsWith("/Test") ? " active open" : "")'>
<a href="javascript:void(0);" class="menu-link menu-toggle">
<i class='menu-icon tf-icons bx bx-food-menu'></i>
<div data-i18n="Test">Test</div>
</a>
<ul class="menu-sub">
<li class='menu-item@(currentPage == "/Test/TestPage" ? " active" : "")'>
<a asp-controller="Test" asp-action="TestPage" class="menu-link">
<div data-i18n="TestPage">TestPage</div>
</a>
</li>
</ul>
</li>
wwwroot\json\locales\{en|fr|de|pt}.cshtml
files.