New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

Provides data for the Telerik.Web.UI.RadUpload.ValidatingFile?text=ValidatingFile ++++++++++++++++event of the RadUpload control.

A ValidatingFileEventArgs is passed to the ValidatingFile handler to provide event data to the handler. The ValidatingFile event is raised when validation is performed on the server. This allows you to perform a custom server-side validation routine on a file of a RadUpload control.

Definition

Properties

Gets or sets whether the value specified by UploadedFile passed validation.

C#
public bool IsValid { get; set; }
Property Value:

true to indicate that the value specified by the UploadedFile passed validation; otherwise, false

Once your validation routine finishes, use the IsValid property to indicate whether the value specified by the UploadedFile passed validation. This value determines whether the file from the RadUpload control passed validation.

Example:
cs-api-definition
Private Sub RadUpload1_ValidatingFile(ByVal sender As Object, ByVal e As WebControls.ValidateFileEventArgs) Handles RadUpload1.ValidatingFile
If e.UploadedFile.GetExtension.ToLower() = ".zip" Then
'The zip files are not allowed for upload
e.IsValid = False
End If
End Sub

Gets or sets whether the internal validation should continue validating the file specified by the UploadedFile property.

C#
public bool SkipInternalValidation { get; set; }
Property Value:

false to indicate that the internal validation should validate the file specified by the UploadedFile property; otherwise, true

Once your validation routine finishes, use the SkipInternalValidation property to skip the internal validation provided by the RadUpload control.

Example:
cs-api-definition
Private Sub RadUpload1_ValidatingFile(ByVal sender As Object, ByVal e As WebControls.ValidateFileEventArgs) Handles RadUpload1.ValidatingFile
If e.UploadedFile.GetExtension.ToLower = ".zip" Then
Dim maxZipFileSize As Integer = 10000000 '~10MB
If e.UploadedFile.ContentLength > maxZipFileSize Then
e.IsValid = False
End If
'The zip files are not validated for file size, extension and mime type
e.SkipInternalValidation = True
End If
End Sub
In this article
DefinitionPropertiesIsValidSkipInternalValidation
Not finding the help you need?
Contact Support