Back to Devexpress

ValidationPattern.ErrorText Property

aspnet-devexpress-dot-web-dot-validationpattern.md

latest3.7 KB
Original Source

ValidationPattern.ErrorText Property

Gets or sets the error text to be displayed within the editor’s error frame if a required editor’s value is not specified.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue("*")]
public virtual string ErrorText { get; set; }
vb
<DefaultValue("*")>
Public Overridable Property ErrorText As String

Property Value

TypeDefaultDescription
String"*"

A String value that specifies the error text.

|

Remarks

The ErrorText property allows you to specify an error text to be displayed if a required editor’s value (the editor’s RequiredFieldValidationPattern.IsRequired property is set to true) is not specified. If the property value is empty, the ValidationSettings.ErrorText property value is used instead.

You can override an error text within validation events, via the ASPxClientEditValidationEventArgs.errorText parameter of the client-side ASPxClientEdit.Validation event or via the ValidationEventArgs.ErrorText parameter of the server-side ASPxEdit.Validation event.

To learn more, see the Validation Error Message topic.

Example

aspx
<dx:ASPxTextBox ID="tbEMail" runat="server" Size="49" NullText="Enter e-mail ..." Font-Size="Small">
    <ValidationSettings EnableCustomValidation="True" ErrorDisplayMode="Text" ErrorTextPosition="Bottom" SetFocusOnError="true">
        <ErrorFrameStyle Font-Size="Smaller"/>
        <RegularExpression ValidationExpression="^\w+([-+.'%]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$" 
            ErrorText="Invalid e-mail"/>
        <RequiredField IsRequired="True" ErrorText="E-mail is required"/>
    </ValidationSettings>
    <NullTextStyle Font-Size="Small"/>
</dx:ASPxTextBox>
aspx
<dx:ASPxTextBox ID="tbEMail" runat="server" Size="49" NullText="Enter e-mail ..." Font-Size="Small">
    <ValidationSettings EnableCustomValidation="True" ErrorDisplayMode="Text" ErrorTextPosition="Bottom" SetFocusOnError="true">
        <ErrorFrameStyle Font-Size="Smaller"/>
        <RegularExpression ValidationExpression="^\w+([-+.'%]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$" 
            ErrorText="Invalid e-mail"/>
        <RequiredField IsRequired="True" ErrorText="E-mail is required"/>
    </ValidationSettings>
    <NullTextStyle Font-Size="Small"/>
</dx:ASPxTextBox>

See Also

Validation

Validation Error Message

ErrorText

ValidationPattern Class

ValidationPattern Members

DevExpress.Web Namespace