# Events

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

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

## Handling by Handler Name

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

```Razor HtmlHelper
    @(Html.Kendo().Window()
        .Name("window")
        .Events(e => e
            .Open("window_open")
            .Close("window_close")
        )
    )
```

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

        function window_close() {
            // Handle the close event.
        }
    </script>

```

## Handling by Template Delegate

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

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

## Next Steps

* [Using the Window Events (Demo)](https://demos.telerik.com/aspnet-mvc/window/events)

## See Also

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