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

Open Window from Menu Item Click by Using Ajax

Environment

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

Description

How can I use a Telerik UI for ASP.NET MVC Menu item click to open a Telerik UI for ASP.NET MVC 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.

More ASP.NET MVC Menu Resources

See Also