Back to Devexpress

ValidationSettings.Display Property

aspnet-devexpress-dot-web-dot-validationsettings-5ce44fac.md

latest6.3 KB
Original Source

ValidationSettings.Display Property

Specifies whether an editor renders an empty space for the error message initially or dynamically when the editor fails validation.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(Display.Static)]
public Display Display { get; set; }
vb
<DefaultValue(Display.Static)>
Public Property Display As Display

Property Value

TypeDefaultDescription
DisplayStatic

One of the numeration values.

|

Available values:

NameDescriptionImage
Static

An editor initially renders an empty space reserved for the error message.

|

| | Dynamic |

An editor renders the space for the error message dynamically at the moment the editor fails validation.

|

| | None |

No error message is displayed.

| |

Property Paths

You can access this nested property as listed below:

Object TypePath to Display
ASPxEdit

.ValidationSettings .Display

| | EditProperties |

.ValidationSettings .Display

|

Remarks

When an editor is displayed inside another control, for instance, is the ASPxGridView or ASPxFormLayout, set the Display property to Dynamic to not render the empty space (the validation error element) near the editor.

Grid Example

aspx
<dx:GridViewDataSpinEditColumn FieldName="UnitPrice">
    <PropertiesSpinEdit DisplayFormatString="c" DisplayFormatInEditMode="true" MinValue="0" MaxValue="60000">
        <ValidationSettings Display="Dynamic" RequiredField-IsRequired="true" />
    </PropertiesSpinEdit>
</dx:GridViewDataSpinEditColumn>
csharp
settings.CellEditorInitialize = (s, e) ={
    ASPxEdit editor = (ASPxEdit)e.Editor;
    editor.ValidationSettings.Display = Display.Dynamic;
};

Form Layout Example

aspx
<dx:LayoutGroup Caption="Personal Information" ColCount="2">
    <Items>
        <dx:LayoutItem Caption="First Name" FieldName="FirstName">
            <LayoutItemNestedControlCollection>
                <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                    <dx:ASPxTextBox ID="firstNameTextBox" runat="server" Width="100%">
                        <ValidationSettings RequiredField-IsRequired="true" Display="Dynamic" />
                    </dx:ASPxTextBox>
                </dx:LayoutItemNestedControlContainer>
            </LayoutItemNestedControlCollection>
        </dx:LayoutItem>
        <dx:LayoutItem Caption="Last Name" FieldName="LastName">
            <LayoutItemNestedControlCollection>
                <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                    <dx:ASPxTextBox ID="lastNameTextBox" runat="server" Width="100%" />
                </dx:LayoutItemNestedControlContainer>
            </LayoutItemNestedControlCollection>
        </dx:LayoutItem>
        <dx:LayoutItem Caption="Birth Date" FieldName="BirthDate">
            <LayoutItemNestedControlCollection>
                <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                    <dx:ASPxDateEdit ID="birthDateEdit" runat="server" />
                </dx:LayoutItemNestedControlContainer>
            </LayoutItemNestedControlCollection>
        </dx:LayoutItem>
    </Items>
</dx:LayoutGroup>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Display 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.

asp-net-mvc-grid-cascading-combo-boxes-in-batch-edit-mode/CS/Models/ComboBoxPropertiesProvider.cs#L94

csharp
cs.FilterMinLength = 2;
cs.ValidationSettings.Display = Display.None;
cs.BindList(OnItemsRequestedByFilterCondition, OnItemRequestedByValue);

asp-net-mvc-grid-cascading-combo-boxes-in-batch-edit-mode/VB/Models/ComboBoxPropertiesProvider.vb#L86

vb
cs.FilterMinLength = 2
cs.ValidationSettings.Display = Display.None
cs.BindList(AddressOf OnItemsRequestedByFilterCondition, AddressOf OnItemRequestedByValue)

See Also

Validation Error Message

Validation

ErrorDisplayMode

ValidationSettings Class

ValidationSettings Members

DevExpress.Web Namespace