This example shows the client-side events supported by Telerik Menu for ASP.NET MVC.

The menu has the following events:

- The OnLoad event is raised when the component is initialized. You can subscribe to that event by using one of the two overloads of the OnLoad method. The one accepts Action as an argument - the other accepts a String. Use the Action overload to define the event handler inline. Use the String overload to specify the name of the JavaScript function which handles the event. The following code shows both options:

      <%= Html.Telerik().Menu()
              .Name("Menu")
              .ClientEvents(events => events
                  .OnLoad("onLoad")
              )

  or

      <% Html.Telerik().Menu()
             .Name("Menu")
             .ClientEvents(events => events
             .OnLoad(() =>
             {
              %>
               function(e) {
                   //perform required actions here.
               }
              <%
             })
             .Render();

- The OnOpen event is raised when a menu item is opened. You can subscribe to that event by using one of the two overloads of the OnOpen method:

      <%= Html.Telerik().Menu()
              .Name("Menu")
              .ClientEvents(events => events
                  .OnOpen("onOpen")
              )

  or

      <% Html.Telerik().Menu()
             .Name("Menu")
             .ClientEvents(events => events
             .OnOpen(() =>
             {
                 %>
                  function(e) {
                      //perform required actions here.
                  }
                 <%
             })
             .Render();

- The OnClose event is raised when a menu item is closed. You can subscribe to that event by using one of the two overloads of the OnClose method:

      <%= Html.Telerik().Menu()
              .Name("Menu")
              .ClientEvents(events => events
                  .OnClose("onClose")
              )

  or

      <% Html.Telerik().Menu()
             .Name("Menu")
             .ClientEvents(events => events
             .OnClose(() =>
             {
                 %>
                  function(e) {
                      //perform required actions here.
                  }
                 <%
             })
             .Render();

- The OnSelect event is raised when a menu item is selected. You can subscribe to that event by using one of the two overloads of the OnSelect method:

      <%= Html.Telerik().Menu()
              .Name("Menu")
              .ClientEvents(events => events
                  .OnSelect("onSelect")
              )

  or

      <% Html.Telerik().Menu()
             .Name("Menu")
             .ClientEvents(events => events
             .OnSelect(() =>
             {
                 %>
                  function(e) {
                      //perform required actions here.
                  }
                 <%
             })
             .Render();