# Events

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

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

## Handling by Handler Name

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

```Razor HtmlHelper
 @using Kendo.Mvc.UI

<script>
    function onCollapse(e) {
        console.log("Collapsed :: Pane <b>#" + e.pane.id + "</b> from splitter <b>#" + this.element[0].id + "</b> collapsed");
    }
</script>

<h4>Splitter with Collapsible Panes</h4>
<div>
@(Html.Kendo().Splitter()
      .Name("splitter")
      .Events(e => e.Collapse("onCollapse"))
      .HtmlAttributes(new { style = "height: 200px;" })
      .Panes(panes =>
      {
          panes.Add()
              .HtmlAttributes(new { id = "left_pane" })
              .Collapsible(true)
              .Size("100px")
              .Content(@<p>
                            Left pane
                        </p>);
    
          panes.Add()
              .HtmlAttributes(new { id = "middle_pane" })
              .Collapsible(true)
              .Content(@<p>
                            Middle pane
                        </p>);
    
          panes.Add()
              .HtmlAttributes(new { id = "right_pane" })
              .Size("20%")
              .Collapsible(true)
              .Content(@<p>
                           Right pane
                        </p>);
      }))
</div>
```

```JavaScript
    <script>
        function onCollapse() {
            // Handle the collapse event.
        }
    </script>
```

## Handling by Template Delegate

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

```Razor HtmlHelper
@(Html.Kendo().Splitter()
      .Name("splitter")
      .Events(e => e.Collapse("function() {
          //Handle the collapse event inline.
       }")
 )
```

## Next Steps

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

## See Also

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