A newer version of this page is available. Switch to the current version.

Validation

The ASPxUploadControl allows you to validate uploaded files. Use the control's validation settings (UploadControlValidationSettings) to specify the allowed file extensions, maximum file size, count and provide error messages for invalid files.

ASPxUploadControl-ValidationOverview

Use the ASPxUploadControl.ValidationSettings property to specify the validation criteria for the uploaded files. If an uploaded file does not meet the validation criteria, its UploadedFile.IsValid property value is false and the control displays the error message. You can also use the FileUploadCompleteEventArgs.IsValid property on the server and the ASPxClientUploadControlFileUploadCompleteEventArgs.isValid property on the client to get the uploaded file's validation state.

Use the ASPxUploadControl.FileUploadComplete server event or the ASPxClientUploadControl.FileUploadComplete client event to provide custom logic to validate the uploaded file(s). If the uploaded file fails your custom validation, you can set the FileUploadCompleteEventArgs.IsValid (ASPxClientUploadControlFileUploadCompleteEventArgs.isValid) property to false and provide a custom error message (FileUploadCompleteEventArgs.ErrorText, (ASPxClientUploadControlFileUploadCompleteEventArgs.errorText)).

See Also