ValidationSummary
Imagine we have a form that contains many form fields. If that page contains
errors, it could be difficult for users to figure out which control caused a given
error, because the page is so big. The ValidationSummary control can alleviate
this problem by presenting the user with a list of error messages in one place on
the page. Lets see the ValidationSummary control in use. Add it to the end of
your Login.aspx file, like so:
File: Login.aspx (excerpt)
<!-- Submit Button -->
<p>
<asp:Button id="submitButton" runat="server" Text="Submit"
OnClick="submitButton_Click" />
</p>
<!-- Validation Summary -->
<p>
<asp:ValidationSummary id="vSummary" runat="server" />
</p>
When the user clicks the Submit button, the ValidationSummary is populated
automatically with a list of all the errors on the page, as we can see in Figure 6.7.
Figure 6.7. Using the ValidationSummary control
235
ValidationSummary

Get Build Your Own ASP.NET 2.0 Web Site Using C# & VB, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.