Home > DeveloperSection > Articles > ValidationSummary Control in ASP.Net

ValidationSummary Control in ASP.Net

ASP.Net ASP.Net 
0 Comment(s)
 5479  View(s)
Rate this:

ValidationSummary Control in ASP.Net

The ValidationSummary control is used to display a summary of all validation errors occurred in a Web page.

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

ValidationSummary Control in ASP.Net


Display Mode

How to display the summary. Legal values are:

·         BulletList

·         List

·         Single Paragraph


A Boolean value that specifies whether the summary should be displayed in a message box or not

Show Summary

A Boolean value that specifies whether the ValidationSummary control should be displayed or hidden


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

    <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"

        ErrorMessage="Enter Your Name">*</asp:RequiredFieldValidator>

    <br />

    <asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>

    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

    <br />

    <asp:Label ID="Label3" runat="server" Text="Confirm Password"></asp:Label>

    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>

    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="TextBox2"

        ControlToValidate="TextBox3" ErrorMessage="NOT MATCHED">*</asp:CompareValidator>

    <br />

    <asp:Label ID="Label4" runat="server" Text="Email Id"></asp:Label>

    <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>

    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox4"

        ErrorMessage="enter a valid email id" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>

    <br />

    <asp:Button ID="Button1" runat="server" Text="Submit" />


ValidationSummary Control in ASP.Net

ValidationSummary Control in ASP.Net

Don't want to miss updates? Please click the below button!

Follow MindStick