Skip to main content

ASPxClientEditValidationEventArgs.errorText Property

Gets or sets the error description.

Declaration

errorText: string

Property Value

Type Description
string

A string representing the error description.

Remarks

The errorText property can be used to provide text explaining why validation failed. If the ASPxClientEditValidationEventArgs.isValid property is set to false, the text will be displayed within a specific error frame.

Example

The code sample below demonstrates how you can perform custom client-side validation to limit an permissible user age. For this purpose, the ASPxClientEdit.Validate event is handled.

function OnBirthdayValidation(s, e) {
     var birthday = e.value;
     if(!birthday)
          return;
     var today = new Date();
     var msecPerYear = 1000 * 60 * 60 * 24 * 365;
     var years = (today.getTime() - birthday.getTime()) / msecPerYear;
     if(years < 14) {
          e.isValid = false;
          e.errorText = "You should be at least 14 years old.";
     }
}
<dx:ASPxDateEdit ID="deBirthday" runat="server" Width="200px">
     <ClientSideEvents Validation="OnBirthdayValidation" />
     <ValidationSettings>
          <RequiredField IsRequired="True" ErrorText="Birthday is required" />
     </ValidationSettings>
</dx:ASPxDateEdit>
See Also