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

RequiredFieldValidationPattern.IsRequired Property

Gets or sets a value that specifies whether the editor is a required field.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(false)]
public bool IsRequired { get; set; }

Property Value

Type Default Description
Boolean **false**

true if the editor is a required field; otherwise, false.

Remarks

Note

When a grid-based control is in Batch Edit mode, set the Display property to Dynamic, so as not to render the empty space (the validation error element) near the edit cell.

Web Forms:


...
<dx:GridViewDataComboBoxColumn FieldName="Answer">
    <PropertiesComboBox>
          ...
        <ValidationSettings Display="Dynamic">
            <RequiredField IsRequired="true" />
          </ValidationSettings>
    </PropertiesComboBox>
</dx:GridViewDataComboBoxColumn>
...

MVC:


settings.CellEditorInitialize = (s, e) => {
    ASPxEdit editor = (ASPxEdit)e.Editor;
    editor.ValidationSettings.Display = Display.Dynamic;
};

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);
            }

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the IsRequired property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also