You can decide how validation errors are reported. For example, rather than putting error messages alongside the control, you can summarize all the validation failures with a
ValidationSummary control. This control can place a summary of the errors in a bulleted list, a simple list, or a paragraph that appears on the web page or in a pop-up message box.
Create a copy of
RequiredFieldValidatorSummary. Add a
ValidationSummary control at the bottom of the page, which requires that you add the following code after the
<asp:ValidationSummary ID="ValSum" runat="server" DisplayMode="BulletList" HeaderText="The following errors were found: " ShowSummary="True" />
You’ve named the
ValSum and set its
DisplayMode property to
HeaderText attribute holds the header that will be displayed only if there are errors to report. You can mix the
ShowSummary attributes to display the errors in the body of the HTML document (
ShowSummary="true"), in a pop-up message box (
ShowMessageBox="true"), or both.
To make this work, you’ll need to add an
ErrorMessage attribute to the other validation controls. For example, you might modify the first validation control as follows:
<asp:RequiredFieldValidator runat=server id="reqFieldBooks" ControlToValidate="ddlBooks" Display="Static" SetFocusOnError=true InitialValue="-- Please Pick A Book --" ErrorMessage = "You did not choose a book from the ...