85
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.
Property | Description |
---|---|
AccessKey | It is used to set keyboard shortcut for the control. |
BackColor | It is used to set background color of the control. |
BorderColor | It is used to set border color of the control. |
Font | It is used to set font for the control text. |
ForeColor | It is used to set color of the control text. |
Text | It is used to set text to be shown for the control. |
ToolTip | It displays the text when mouse is over the control. |
Visible | To set visibility of control on the form. |
Height | It is used to set height of the control. |
Width | It is used to set width of the control. |
ShowMessageBox | It displays a message box on error in up-level browsers. |
ShowSummary | It is used to show summary text on the form page. |
ShowValidationErrors | It 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.
It throws error summary when user login without credentials.
Next TopicMVC Tutorial