Skip to main content

Validation

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

ASPxUploadControl-ValidationOverview

Use the 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 set to false and the control displays an error message. You can also use the server-side FileUploadCompleteEventArgs.IsValid property and the client-side ASPxClientUploadControlFileUploadCompleteEventArgs.isValid property to get the uploaded file’s validation state.

Use the server-side FileUploadComplete event or the client-side FileUploadComplete event to validate the uploaded file according to your custom rules. If the uploaded file fails the validation, you can set the FileUploadCompleteEventArgs.IsValid (ASPxClientUploadControlFileUploadCompleteEventArgs.isValid - for the client-side event) property to false and display a custom error message. Use the FileUploadCompleteEventArgs.ErrorText property to specify the error text within the server-side event and the ASPxClientUploadControlFileUploadCompleteEventArgs.errorText property - within the client-side event.

See Also