Skip to main content

Validation Summary

  • 2 minutes to read

The ASPxValidationSummary control allows you to summarize validation errors from multiple controls and display them in a single block. This helps to organize screen space more effectively if validation is required for several editors.

ASPxValidationSummary_concepts_overview.png

View Example: Page Control for ASP.NET Web Forms - How to create a wizard interface Run Demo: Validation Summary

Main Features

Three Render Modes

Use the ASPxValidationSummary.RenderMode property to specify the manner in which ASPxValidationSummary displays validation error text within its panel. The following properties allow you to display error text as a table, a bulleted list, or an ordered list:

Appearance Affected Properties
ASPxValidationSummary_table RenderMode=Table
ASPxValidationSummary_bulletedlist RenderMode=BulletedList
ASPxValidationSummary_orderedlist RenderMode=OrderedList

You can add a link to validation error text. To do this, set the ASPxValidationSummary.ShowErrorAsLink property to true. When a user clicks the link, focus moves to the corresponding invalid editor.

ASPxValidationSummary_concepts_overview_links

The ASPxClientValidationSummary object is the client-side equivalent of the ASPxValidationSummary control. This object exposes the control’s comprehensive client-side API.

Example: How to show ASPxValidationSummary inside ASPxPopupControl when validation fails

Follow the steps below to show ASPxValidationSummary inside ASPxPopupControl when validation fails.

  1. Define ASPxValidationSummary inside ASPxPopupControl.
  2. Add the invisible ASPxGlobalEvents component onto a form.
  3. Handle the client-side ValidationCompleted event.
  4. If validation fails (e.isValid is false), call the Show method to show the popup control.
function OnValidationCompleted(s, e) {
    if (e.isValid)
        alert("Validation Passed");
    else
        popup.Show();
}
<dx:ASPxGlobalEvents ID="globalEvents" runat="server">
    <ClientSideEvents ValidationCompleted="OnValidationCompleted" />
</dx:ASPxGlobalEvents>
<dx:ASPxPopupControl ID="popupControl" runat="server" ClientInstanceName="popup"
    CloseAction="CloseButton" HeaderText="ValidationSummary" PopupHorizontalAlign="WindowCenter"
    PopupVerticalAlign="WindowCenter">
    <ContentCollection>
        <dx:PopupControlContentControl runat="server">
            <dx:ASPxValidationSummary ID="validationSummary" runat="server" />
        </dx:PopupControlContentControl>
    </ContentCollection>
</dx:ASPxPopupControl>
<dx:ASPxTextBox ID="txtFirstName" runat="server" Width="170px">
    <ValidationSettings>
        <RequiredField IsRequired="true" ErrorText="FirstName Is Required" />
    </ValidationSettings>
</dx:ASPxTextBox>
<dx:ASPxTextBox ID="txtLastName" runat="server" Width="170px">
    <ValidationSettings>
        <RequiredField IsRequired="true" ErrorText="LastName Is Required" />
    </ValidationSettings>
</dx:ASPxTextBox>
<dx:ASPxButton ID="btn" runat="server" Text="Validate">
</dx:ASPxButton>
See Also