ASPxClientUploadControl.FileUploadComplete Event
Occurs on the client side after a file has been uploaded.
Declaration
FileUploadComplete: ASPxClientEvent<ASPxClientUploadControlFileUploadCompleteEventHandler<ASPxClientUploadControl>>
Event Data
The FileUploadComplete event's data class is ASPxClientUploadControlFileUploadCompleteEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
callbackData | Gets a string that contains specific information (if any) passed from the server side for further client processing. |
errorText | Gets the error text to be displayed within the ASPxUploadControl‘s error frame. |
inputIndex | Gets the index of a file input element within the ASPxUploadControl. |
isValid | Gets or sets a value indicating whether the uploaded file passes validation. |
Remarks
Write the FileUploadComplete event handler to perform specific client actions after a file has been uploaded to a server. If several files have been selected for upload, the FileUploadComplete event fires for each of them. After all files have been uploaded, the ASPxClientUploadControl.FilesUploadComplete event fires.
Example
<script type="text/javascript">
function onFileUploadStart(s, e) {
DXUploadedFilesContainer.Clear();
}
function onFileUploadComplete(s, e) {
if(e.callbackData) {
var fileData = e.callbackData.split('|');
var fileName = fileData[0],
fileUrl = fileData[1],
fileSize = fileData[2];
DXUploadedFilesContainer.AddFile(fileName, fileUrl, fileSize);
}
}
</script>
...
<dx:ASPxUploadControl ID="UploadControl" runat="server" ClientInstanceName="UploadControl" Width="100%"
NullText="Select multiple files..." UploadMode="Advanced" ShowUploadButton="True" ShowProgressPanel="True"
OnFileUploadComplete="UploadControl_FileUploadComplete">
<AdvancedModeSettings EnableMultiSelect="True" EnableFileList="True" EnableDragAndDrop="True" />
<ValidationSettings MaxFileSize="4194304" AllowedFileExtensions=".jpg,.jpeg,.gif,.png">
</ValidationSettings>
<ClientSideEvents FilesUploadStart="onFileUploadStart" FileUploadComplete="onFileUploadComplete" />
</dx:ASPxUploadControl>
<dx:UploadedFilesContainer ID="FileContainer" runat="server" Width="100%" Height="180"
NameColumnWidth="240" SizeColumnWidth="70" HeaderText="Uploaded files" />
See Also