ValidationSummary in ASP.NET

This control summarizes the error messages from all validation controls on a Web page in a single location. ValidationSummary control is useful when working with large forms.

If a user enters the wrong value in the field located at the end of the page, then the user might never see the error message. ValidationSummary control can displays a list of errors at the top of the form. It does not support ErrorMessage and ControlToValidate property. It automatically displays the error message in the form of MessageBox or summary if error occurs due to empty input field or wrong data.

Important Properties

DisplayMode: BulletList, List, and SingleParagraph

HeaderText: Display header text above the validation summary.

ShowMessageBox: It is used to display a popup alert box

ShowSummary: It hides the validation summary in the page.

By default ShowMessageBox property value is set False and ShowSummary property value is set True. You can use these properties according to your need.

<asp:ValidationSummary ID="ValidationSummary1"
        runat="server" >
</asp:ValidationSummary>


Example:
In the given example, We have not entered EmpID and EmpName and entered some
wrong data(Email, password), so you can see the error messages.

validationsummary