# Events

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

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

> The following events fire only when the Upload is in an asynchronous mode of operation: `Cancel`, `Complete`, `Error`, `Progress`, `Success`, and `Upload`.

## Handling by Handler Name

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

```Razor HtmlHelper
    @(Html.Kendo().Upload()
        .Name("upload")
        .Multiple(true)
        .Async(a => a
           .Save("SaveAsync", "Upload")
           .Remove("Remove", "Upload")
        )  
        .Events(events => events
           .Upload("onUpload")
           .Success("onSuccess")
       )
    )

    <script>
        function onUpload(e) {
            // Handle the upload event.
        }
        function onSuccess(e) {
            // Handle the success event.
        }
    </script>
```

```Razor TagHelper
    <kendo-upload name="upload"
                  on-upload="onUpload"
                  on-success="onSuccess">
        <async auto-upload="true" 
               save-url="@Url.Action("SaveAsync", "Upload")" 
               remove-url="@Url.Action("Remove","Upload")" />
    </kendo-upload>

     <script>
        function onUpload(e) {
            // Handle the Upload event.
        }
        function onSuccess(e) {
            // Handle the Success event.
        }
    </script>
```

## Handling by Template Delegate

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

```Razor HtmlHelper
    @(Html.Kendo().Upload()
        .Name("upload")
        .Multiple(true)
        .Async(a => a
           .Save("SaveAsync", "Upload")
           .Remove("Remove", "Upload")
        )  
        .Events(events => events
           .Upload(@<text>
                function() {
                    // Handle the Upload event inline.
                }
            </text>)
           .Success(@<text>
                function() {
                    // Handle the Success event inline.
                }
            </text>)
       )
    )
```

```Razor TagHelper
    <kendo-upload name="upload"
                  on-upload="function() {
                        // Handle the Upload event inline.
                  }"
                  on-success="function() {
                        // Handle the Success event inline.
                  }">
        <async auto-upload="true" 
               save-url="@Url.Action("SaveAsync", "Upload")" 
               remove-url="@Url.Action("Remove","Upload")" />
    </kendo-upload>
```

## Next Steps

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

## See Also

* [Using the API of the Upload for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/upload/api)
* [Upload Server-Side API for ASP.NET Core](https://www.telerik.com/aspnet-core-ui/documentation/api/upload)
* [Upload Client-Side API](https://docs.telerik.com/kendo-ui/api/ui/upload)
