We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Performing an action when selecting a menu

I'm trying to get an action to occur when clicking an item in a Blazor menu, however nothing seems to work - something like this:
Can you advise where I'm going wrong please?
public class HomeController : Controller
{
public IActionResult Index()
{
List menuItems = new List(){
new MenuItem
{
Text = "File",
IconCss = "em-icons e-file",
Items = new List()
{
new MenuItem { Text= "Open", IconCss= "em-icons e-open", Url= "Home/Open" },
new MenuItem { Text= "Save", IconCss= "e-icons e-save", Url= "Home/Save" },
new MenuItem { Separator= true },
new MenuItem { Text= "Exit", Url= "Home/Exit" }
}
},
new MenuItem { Text = "Help" }
};

ViewBag.menuItems = menuItems;
return View();
}
public IActionResult Open()
{
Console.WriteLine("You clicked Open ...................");
Debug.WriteLine("You clicked Open ..................");
Trace.WriteLine("You clicked Open ..................");
return View(); // Triggered for Open click
}
public IActionResult Save()
{
Console.WriteLine("You clicked Save ...................");
Debug.WriteLine("You clicked Save ..................");
Trace.WriteLine("You clicked Save ..................");
return View(); // Triggered for Save click
}
public IActionResult Exit()
{
Console.WriteLine("You clicked Exit ...................");
Debug.WriteLine("You clicked Exit ..................");
Trace.WriteLine("You clicked Exit ..................");
return View(); // Triggered for Exit Click
}
}

1 Reply

PO Prince Oliver Syncfusion Team May 14, 2019 10:04 AM UTC

Hi Charles, 

Thank you for contacting us. 

We have checked your reported issue and we are able to reproduce it in our end. We confirmed this as a defect and logged the defect report for the same. The fix for this issue will be includded in our upcoming EJ2 patch release schedule on last week of May 2019. We appreciate your patience until then. Meanwhile you can track the status of the report through the following feedback portal link. 

Regards, 
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon