Skip to main content
A newer version of this page is available. .
Tab

ValidationSettings.RequiredField Property

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

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v21.2.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:

Library Object Type Path to RequiredField
ASP.NET Bootstrap Controls BootstrapSchedulerDateNavigatorProperties
.ValidationSettings .RequiredField
ASP.NET Web Forms Controls ASPxEdit
.ValidationSettings .RequiredField
EditProperties
.ValidationSettings .RequiredField

Example

The complete sample project is available in the DevExpress Code Central database at E942.

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