Skip to main content
Tab

UploadControlValidationSettings.NotAllowedContentTypeErrorText Property

OBSOLETE

Use the NotAllowedFileExtensionErrorText property instead.

Gets or sets the error text indicating that the specified file’s content type is not allowed.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

[DefaultValue("This content type isn't allowed")]
[Obsolete("Use the NotAllowedFileExtensionErrorText property instead.")]
public string NotAllowedContentTypeErrorText { get; set; }

Property Value

Type Default Description
String "This content type isn't allowed"

A String value that specifies the error text.

Property Paths

You can access this nested property as listed below:

Library Object Type Path to NotAllowedContentTypeErrorText
ASP.NET MVC Extensions UploadControlBinderSettings
.ValidationSettings .NotAllowedContentTypeErrorText
UploadControlSettings
.ValidationSettings .NotAllowedContentTypeErrorText
ASP.NET Web Forms Controls ASPxUploadControl
.ValidationSettings .NotAllowedContentTypeErrorText

Remarks

If the uploaded file’s content type is not listed within the UploadControlValidationSettings.AllowedContentTypes property, an error text specified by the NotAllowedContentTypeErrorText property is displayed within the ASPxUploadControl‘s specific error frame.

Example

<dx:ASPxUploadControl ID="ASPxUploadControl1" runat="server" OnFileUploadComplete="uc_FileUploadComplete">
    <ValidationSettings AllowedFileExtensions=".txt,.jpg,.jpe,.jpeg,.doc" MaxFileSize="1000000" 
        FileDoesNotExistErrorText="A file cannot be found." 
        GeneralErrorText="File uploading fails due to an external error that doesn't relate to the ASPxUploadControl's functionality." 
        MaxFileSizeErrorText="Uploaded file size exceeds the maximum file size." 
        NotAllowedFileExtensionErrorText="The file extension is not allowed.">
        <ErrorStyle BackColor="Yellow" ForeColor="Black" />
    </ValidationSettings>
</dx:ASPxUploadControl>
protected void uc_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) {
    if (e.IsValid) {
        ASPxUploadControl1.SaveAs(MapPath("Images/" + ASPxUploadControl1.FileName));
    }
}
See Also