Validationsummary Control in ASP.Net

The ValidationSummary control is used to display a summary of all the validation control error messages  in a single control on web forms in asp.net. We can also cay the valiudationsummary control is the summary of all the validation control error messages display on web forms.

The Validationsummary control display all the validation control error message at single place in asp.net.

lets understand validationsummary control with an example.

Design the asp.net web forms with four textbox and four validation control for each textbox and a button control along with the validationsummary control.

Here is the html code for design asp.net web forms.

Here is the design of web forms :

ValidationSummary Control in ASP.Net

How to use ValidationSummary Control in ASP.Net

In above asp.net web forms figure shows the design of web forms. we have taken four textbox control for name, city, pincode and mobile number and provide validation control for each.

Here, we take requiredfield validator for name and city textbox and Range validator for Mobile number and RegularExpression validator for Email Address.

Now, set the proper error message to all the validator control as per requirement. In below figure we set all the error messages to validation control.

How to use ValidationSummary Control in ASP.Net

How to use ValidationSummary Control in ASP.Net

There are three method or layout for display validationSummary control on asp.net web forms. If we need to change the layout of validationSummary then set the DisplayMode property of control.

DisplayMode = Lkist, BulletList, SingleParagraph

Below, figure shows how to change or set DisplayMode property of validationSummary control in asp.net.

How to use ValidationSummary Control in ASP.Net

How to use ValidationSummary Control in ASP.Net

If we set DisplayMode=BulletList then the validationsummary exmaple result look like below screen.

All the error messages are together listed as bullet list.

How to use ValidationSummary Control in ASP.Net

How to use ValidationSummary Control in ASP.Net

Now, change the DisplayMode from Bulletlist to SingleParagraph shows like below.

How to use ValidationSummary Control in ASP.Net

How to use ValidationSummary Control in ASP.Net

The Result for DisplayMode=SingleParagraph, all the error messages are displayed as single paragraph format.

How to use ValidationSummary Control in ASP.Net

How to use ValidationSummary Control in ASP.Net

If we set DisplayMode=List, then validationsummary out put will be like this.

How to use ValidationSummary Control in ASP.Net

How to use ValidationSummary Control in ASP.Net

There are another two property of validationsummary control we need to understand the first one is ShowMessageBox and ShowSumary.

The ShowMessageBox=true then validationsummary control error message display on alertbox like javascript box.

How to use ValidationSummary Control in ASP.Net

How to use ValidationSummary Control in ASP.Net

Here, we set the SowMessageBox= true, we can see here all the validation messages in alert box.

How to use ValidationSummary Control in ASP.Net

How to use ValidationSummary Control in ASP.Net

The ShowSummary property used to show or hide the vaildationsummary error messages on web forms.

Here, we set ShowMessageBox=True and ShowSummary=False

How to use ValidationSummary Control in ASP.Net

How to use ValidationSummary Control in ASP.Net

I hope you will like this validationSummary control post with an example…….

Leave a Reply

Your email address will not be published. Required fields are marked *

1 + 2 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">