Back to Devexpress

ValidationSettings.ValidateOnLeave Property

aspnet-devexpress-dot-web-dot-validationsettings-31ad2ef1.md

latest2.6 KB
Original Source

ValidationSettings.ValidateOnLeave Property

Gets or sets a value that specifies whether validation is performed when the editor value is changed.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(true)]
public bool ValidateOnLeave { get; set; }
vb
<DefaultValue(True)>
Public Property ValidateOnLeave As Boolean

Property Value

TypeDefaultDescription
Booleantrue

true to perform validation on an editor value change; otherwise, false.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to ValidateOnLeave
ASPxEdit

.ValidationSettings .ValidateOnLeave

| | EditProperties |

.ValidationSettings .ValidateOnLeave

|

Remarks

To validate edit values on a specific action (for example, on a button click), call the client-side Validate method. To disable automatical validation when the editor’s value changes, set the ValidateOnLeave property to false.

aspx
<input type="button" value="Validate" onclick="ASPxClientControl.GetControlCollection().GetByName('tbTextBox2').Validate();" style="width: 127px;" />
<dx:ASPxTextBox ID="tbTextBox2" runat="server" ClientInstanceName="tbTextBox2" Width="170px">
    <ValidationSettings ValidateOnLeave="False">
        <RequiredField IsRequired="True" ErrorText="Field is required." />
    </ValidationSettings>
</dx:ASPxTextBox>

View Example: How to raise validation on the client

See Also

How to: Validate a Particular Editor

Validation

ValidationSettings Class

ValidationSettings Members

DevExpress.Web Namespace