Hi Bhanu,
Thank you for contacting Syncfusion support.
We have checked your requirement and achieved it by rendering the Menu component in layout.cshtml page and navigate the page by using url property. Please find the below code snippet,
Layout.cshtml
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">WebApplication1</a>
</div>
<div class="menu-control">
<ejs-menu id="menu" items="ViewBag.menuItems" asp-action="About"></ejs-menu>
</div>
</div>
</nav> |
Homecontroller.cs
public IActionResult Index()
{
//define the array of JSON
ViewBag.menuItems = GetMenuItems();
return View();
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
ViewBag.menuItems = GetMenuItems();
return View();
}
public List<MenuItem> GetMenuItems()
{
List<MenuItem> menuItems = new List<MenuItem>(){
new MenuItem
{
Text = "File",
Url ="../Home/About"
},
//..
new MenuItem { Text = "Help", Url = "../Home/About" }
};
return menuItems;
} |
For your convenience we have prepared a sample. Please find the sample link in below,
Regards,
Vinoth Kumar S