ASP.NET ValidationSummary Control

This validator is used to display list of all validation errors in the web form.

It allows us to summarize the error messages at a single location.

We can set DisplayMode property to display error messages as a list, bullet list or single paragraph.

ValidationSummary Properties

This control has following properties.

PropertyDescription
AccessKeyIt is used to set keyboard shortcut for the control.
BackColorIt is used to set background color of the control.
BorderColorIt is used to set border color of the control.
FontIt is used to set font for the control text.
ForeColorIt is used to set color of the control text.
TextIt is used to set text to be shown for the control.
ToolTipIt displays the text when mouse is over the control.
VisibleTo set visibility of control on the form.
HeightIt is used to set height of the control.
WidthIt is used to set width of the control.
ShowMessageBoxIt displays a message box on error in up-level browsers.
ShowSummaryIt is used to show summary text on the form page.
ShowValidationErrorsIt is used to set whether the validation summary should be shown or not.

Example

The following example explains how to use ValidationSummery control in the application.

// ValidationSummeryDemo.aspx

Output:

It produces the following output when view in the browser.

ASP Validation summary 1

It throws error summary when user login without credentials.

ASP Validation summary 2
Next TopicMVC Tutorial




Latest Courses