Back to Devexpress

UploadControlValidationSettings.ErrorStyle Property

aspnet-devexpress-dot-web-dot-uploadcontrolvalidationsettings-ef15d303.md

latest3.3 KB
Original Source

UploadControlValidationSettings.ErrorStyle Property

Gets the style settings for rendering the error message that is displayed if the uploaded file does not pass validation.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public AppearanceStyleBase ErrorStyle { get; }
vb
Public ReadOnly Property ErrorStyle As AppearanceStyleBase

Property Value

TypeDescription
AppearanceStyleBase

A AppearanceStyleBase object that contains style settings for the error message.

|

Property Paths

You can access this nested property as listed below:

LibraryObject TypePath to ErrorStyle
ASP.NET MVC ExtensionsUploadControlBinderSettings

.ValidationSettings .ErrorStyle

| | UploadControlSettings |

.ValidationSettings .ErrorStyle

| | ASP.NET Web Forms Controls | ASPxUploadControl |

.ValidationSettings .ErrorStyle

|

Example

aspx
<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>
csharp
protected void uc_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) {
    if (e.IsValid) {
        ASPxUploadControl1.SaveAs(MapPath("Images/" + ASPxUploadControl1.FileName));
    }
}
vb
Protected Sub uc_FileUploadComplete(ByVal sender As Object, ByVal e As DevExpress.Web.FileUploadCompleteEventArgs)
    If e.IsValid Then
        ASPxUploadControl1.SaveAs(MapPath("Images/" & ASPxUploadControl1.FileName))
    End If
End Sub

See Also

UploadControlValidationSettings Class

UploadControlValidationSettings Members

DevExpress.Web Namespace