Skip to main content
Tab

ValidationSettings.RequiredField Property

Gets the settings that define the required field validation’s rules.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public RequiredFieldValidationPattern RequiredField { get; }

Property Value

Type Description
RequiredFieldValidationPattern

A RequiredFieldValidationPattern object that contains specific validation settings.

Property Paths

You can access this nested property as listed below:

Object Type Path to RequiredField
ASPxEdit
.ValidationSettings .RequiredField
EditProperties
.ValidationSettings .RequiredField

Example

function OnValidationCompleted(s, e) {
    if(e.isValid && Password.GetValue() != ConfirmedPassword.GetValue()) {
        ConfirmedPassword.SetFocus();
        ErrorMessageNotEqual.SetVisible(true);
        e.isValid = false;
    } else
        ErrorMessageNotEqual.SetVisible(false);
}
<script runat="server">
     protected void Page_Load(object sender, EventArgs e) {

     }
     protected void ASPxGlobalEvents1_ValidationCompleted(object sender, 
         DevExpress.Web.ValidationCompletedEventArgs e) {
         lErrorMessageNotEqual.ClientVisible 
            = !tbPassword.Value.Equals(tbConfirmedPassword.Value);
     }
</script>
...
         Type password:<br/>
         <dxe:ASPxTextBox ID="tbPassword" runat="server" Width="170px" 
         ClientInstanceName="Password" Password="True">
         <ValidationSettings SetFocusOnError="true">
             <RequiredField IsRequired="True" />
         </ValidationSettings>
         </dxe:ASPxTextBox>
         <br/>
         Confirm password:
         <dxe:ASPxTextBox ID="tbConfirmedPassword" runat="server" Width="170px" 
          ClientInstanceName="ConfirmedPassword" Password="True">
             <ValidationSettings SetFocusOnError="true">
                 <RequiredField IsRequired="True" />
             </ValidationSettings>
         </dxe:ASPxTextBox>
...
See Also