New to Telerik UI for ASP.NET CoreStart a free 30-day trial

Open Window from Menu Item Click by Using Ajax

Environment

ProductTelerik UI for ASP.NET Core Menu
Product VersionCreated with version 2024.4.1112

Description

How can I use a Telerik UI for ASP.NET Core Menu item click to open a Telerik UI for ASP.NET Core Window?

Solution

  1. Declare the Menu component.
  2. Handle the Select event of the Menu.
  3. In the event handler, get the id attribute of the current item.
  4. Conditionally check if the id is the expected one (openWindow).
  5. Implement an Ajax request to an Action Method, which is specified in the Menu item.
  6. In the Action Method, return a Partial View with the Window.
Razor
    @{Html.Kendo().Menu()
          .Orientation(MenuOrientation.Horizontal)
          .Name("applicationMenu")
          .Items(menu => menu.Add().Text("Home").Items(homeMenu =>
              {
                  homeMenu.Add().Text("Show Window").Action("RenderWindow", "Home").HtmlAttributes(new { id = "openWindow" });
              }))
          .Events(e => e.Select("onSelect"))
          .Render();
    }

For the complete implementation of the suggested approach, refer to the ASP.NET MVC project on how to open a Window when a specified Menu item is clicked. You can use this as a starting point to configure the same setup in an ASP.NET Core project.

More ASP.NET Core Menu Resources

See Also