New to Telerik UI for ASP.NET Core? Download free 30-day trial

Events

The Telerik UI Upload for ASP.NET Core exposes multiple events 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.

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.

    @(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>
    <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.

    @(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>)
       )
    )
    <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

See Also

In this article