# Events

You can subscribe to the [available DataSource events](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourceeventbuilder) and further customize the behavior of the DataSource.

## Handling by Handler Name

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

```Razor HtmlHelper
   @(Html.Kendo().DataSource<ProductViewModel>()
        .Name("dataSource1")
        .Ajax(dataSource => dataSource
            .Events(ev => ev.RequestStart("onRequestStart"))
            .Read(read => read.Action("Products_Read", "DataSource"))
            ... // Additional configuration
        )
    )

    <script>
        function onRequestStart(e){
            // Handle the RequestStart event that triggers the DataSource makes a request to the remote service.
        }
    </script>
```

```Razor TagHelper
    <kendo-datasource name="dataSource1" type="DataSourceTagHelperType.Ajax" on-request-start="onRequestStart">
        <transport>
            <read url="@Url.Action("Products_Read", "DataSource")" />
        </transport>
        
    </kendo-datasource>

    <script>
        function onRequestStart(e){
            // Handle the RequestStart event that triggers when the DataSource makes a request to the remote service.
        }
    </script>
```

## Handling by Template Delegate

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

```Razor HtmlHelper
   @(Html.Kendo().DataSource<ProductViewModel>()
        .Name("dataSource1")
        .Ajax(dataSource => dataSource
            .Read(read => read.Action("Products_Read", "DataSource"))
            .Events(e => e.RequestStart(@<text>
                function() {
                    // Handle the RequestStart event inline.
                }
                </text>)
            )
            ... // Additional configuration
        )
    )
```

```Razor TagHelper
    <kendo-datasource name="dataSource1" type="DataSourceTagHelperType.Ajax" on-request-start="function() {
            // Handle the RequestStart event inline.
        }">
        <transport>
            <read url="@Url.Action("Products_Read", "DataSource")" />
        </transport>
        
    </kendo-datasource>
```

## See Also

* [DataSource Server-Side API for ASP.NET Core](https://www.telerik.com/aspnet-core-ui/documentation/api/datasource)

* [DataSource Server-Side TagHelper API for ASP.NET Core](https://docs.telerik.com/aspnet-core/api/taghelpers/datasource)

* [DataSource Client-Side API](https://docs.telerik.com/kendo-ui/api/data/datasource)
