# Events

The Telerik UI Menu for ASP.NET MVC [exposes a number of events](https://www.telerik.com/aspnet-mvc/documentation/api/kendo.mvc.ui.fluent/menueventbuilder) that allow you to control and customize the UI component.

For a complete example on basic Menu events, refer to the [demo on using the events of the Menu](https://demos.telerik.com/aspnet-mvc/menu/events).

## Handling by Handler Names

The following example demonstrates how to subscribe to events by a handler name.

```Razor HtmlHelper
@(Html.Kendo().Menu()
        .Name("menu")
        .Events(e => e
            .Open("menu_open")
            .Close("menu_close")
        )
)
<script>
    function menu_close() {
        // Handle the close event.
    }

    function menu_open() {
        // Handle the open event.
    }
</script>
```

## Handling by Template Delegates

The following example demonstrates how to subscribe to events by a template delegate.

```Razor HtmlHelper
@(Html.Kendo().Menu()
    .Name("menu")
    .Events(e => e
        .Open(@<text>
            function() {
                // Handle the open event inline.
            }
        </text>)
        .Close(@<text>
            function() {
                // Handle the close event inline.
            }
        </text>)
    )
)
```

## Handling by HTML Attributes

The following example demonstrates how to subscribe to the `select` event of a single Menu item.

```Razor HtmlHelper
@(Html.Kendo().Menu()
    .Name("menu")
    .Items(items =>
    {
        items.Add().Text("First Item");
        items.Add().Text("Second Item").HtmlAttributes(new { @onclick = "alert('select');" });
    })
)
```

## Next Steps

* [Using the Menu Events (Demo)](https://demos.telerik.com/aspnet-core/menu/events)

## See Also

* [Using the API of the Menu for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/menu/api)
* [Menu Server-Side API](https://www.telerik.com/aspnet-mvc/documentation/api/menu)
* [Menu Client-Side API](https://docs.telerik.com/kendo-ui/api/ui/menu)
