# Events

**RadAsyncUpload** supports the following client-side events:

## RadAyncUpload

* [OnClientAdded](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientadded) - Occurs when a row has just been added to the **RadAsyncUpload** control.

* [OnClientFileDropped](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientfiledropped) -Occurs when file(s) are dropped on some of the drop zones of **RadAsyncUpload**.

* [OnClientFilesSelected](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientfilesselected) - Occurs when the files are selected immediately after pressing the "Open" button.

* [OnClientFileSelected](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientfileselected) - Occurs when a file is selected using the file input.

* [OnClientFileUploading](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientfileuploading) -Occurs when a file upload has commenced.

* [OnClientFileUploaded](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientfileuploaded) - Occurs when a file has finished uploading.

* [OnClientFilesUploaded](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientfilesuploaded) -Occurs when all files have finished uploading.

* [OnClientValidation](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientvalidationfailed) -Occurs when a uploaded file is about to be removed from the uploaded files collection.

* [OnClientFileUploadRemoving](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientfileuploadremoving) - Occurs when a uploaded file is about to be removed from the uploaded files collection.

* [OnClientFileUploadRemoved](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientfileuploadremoved) -Occurs when a uploaded file is removed from the uploaded files collection.

* [OnClientValidationFailed](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientvalidationfailed) - Occurs when a client-side validation has failed for the selected file. A file is validated onthe client by extension and/or file size.

* [OnClientFileUploadFailed](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientfileuploadfailed) - Occurs when a file upload has failed due to an HTTP or server-side error.

To use these events, simply write a JavaScript function that can be called when the event occurs. Then assign the name of the JavaScript function as the value of the corresponding property:

```ASPNET
<telerik:radupload id="RadUpload1" runat="server" onclientfileuploadremoving="confirmDeletes"></telerik:radupload>
```

You can also assign event handlers in client-side code. When using the client-side API, pass a reference to the event handler rather than its name. One advantage of using the client-side API is that you can attach multiple event handlers to one event using the standard Microsoft AJAX convention:

```JavaScript
<script type="text/javascript">

	function confirmDeletes(sender, eventArgs) {
		if (!confirm("Are you sure you want to delete the selected row?")) eventArgs.set_cancel(true); 
	}
	 
	function onAddedHandler1() {
		alert("First handler called");
	}

	function onAddedHandler2() {
		alert("Second handler called"); 
	}

	function pageLoad() {
		var upload = $find("<%= RadUpload1.ClientID %>");
		upload.add_added(onAddedHandler1);
		upload.add_added(onAddedHandler2); 
	}
 </script>
```

Another advantage of the client-side API is that you can detach an event handler dynamically:

```JavaScript
<script type="text/javascript">
	function removeOnAdded2() {
		var upload = $find("<%= RadUpload1.ClientID %>");
		upload.remove_added(onAddedHandler2); 
	}
</script>
```

Note that on the client-side, the names of events are slightly different than on the server side. The following table shows the correspondence between client-side and server-side names:

> caption  

| Server-Side Name           | Client-SideName    | Methods to add and Remove                         |
| -------------------------- | ------------------ | ------------------------------------------------- |
| OnClientAdded              | added              | add_added, remove_added                           |
| OnClientFileSelected       | fileSelected       | add_fileSelected, remove_fileSelected             |
| OnClientFileUploading      | fileUploading      | add_fileUploading, remove_fileUploading           |
| OnClientFileUploaded       | fileUploaded       | add_fileUploaded, remove_fileUploaded             |
| OnClientFilesUploaded      | filesUploaded      | add_filesUploaded, remove_filesUploaded           |
| OnClientProgressUpdating   | progressUpdating   | add_progressUpdating, remove_progressUpdating     |
| OnClientValidationFailed   | validationFailed   | add_validationFailed, remove_validationFailed     |
| OnClientFileUploadFailed   | fileUploadFailed   | add_fileUploadFailed, remove_fileUploadFailed     |
| OnClientFileUploadRemoving | fileUploadRemoving | add_fileUploadRemoving, remove_fileUploadRemoving |
| OnClientFileUploadRemoved  | fileUploadRemoved  | add_fileUploadRemoved, remove_fileUploadRemoved   |

## See Also

[Getting Started](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/getting-started)

[Client-Side Basics](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/overview)

[OnClientAdded](https://www.telerik.com/products/aspnet-ajax/documentation/controls/asyncupload/client-side-programming/onclientadded)
