- ValidationSummary Web Server Control
in ASP.NET environment,This article describes you how to work with ValidationSummary Web Control.The primary mechanism of the ValidationSummary is to list the bundle of Error message in the ValidationSummary Control.Use the ValidationSummary control to present the user with a list of validation errors that occurred when a form was posted to the server. The ValidationSummary also displays a back link for the user to return to the form and correct the data entry.
The ValidationSummary control allows you to summarize the error messages from all validation controls on a Web page in a single location. The summary can be displayed as a list, a bulleted list, or a single paragraph, based on the value of the DisplayMode property. The error message displayed in the ValidationSummary control for each validation control on the page is specified by the ErrorMessage property of each validation control
The following code snippets explains you the ValidationSummary
-
<form id="Form2" runat="server">
<table cellpadding="10">
<tr>
<td>
<table bgcolor="#eeeeee" cellpadding="10">
<tr>
<td colspan="3">
<b>Credit Card Information</b>
</td>
</tr>
<tr>
<td align="right">
Card Type:
</td>
<td>
<asp:RadioButtonList ID="rb1" RepeatLayout="Flow"
runat="server">
<asp:ListItem>MasterCard</asp:ListItem>
<asp:ListItem>Visa</asp:ListItem>
</asp:RadioButtonList>
</td>
<td align="middle" rowspan="1">
<asp:RequiredFieldValidator ID="rfv1"
ControlToValidate="rb1"
ErrorMessage="Card Type." Display="Static"
InitialValue="" Width="100%" Text="*"
runat="server" />
</td>
</tr>
<tr>
<td align="right">
User Id:
</td>
<td>
<asp:TextBox ID="txt1" runat="server" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
ControlToValidate="txt1"
ErrorMessage="User Id. " Display="Static"
Width="100%" Text="*" runat="server" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="btn1" Text="Validate" runat="server" />
</td>
<td>
</td>
</tr>
</table>
</td>
<td valign="top">
<table cellpadding="20">
<tr>
<td>
<asp:ValidationSummary ID="valSum"
DisplayMode="BulletList" EnableClientScript="true"
HeaderText="fill all the fields:" runat="server" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
-
- Related Links
-
a5d3ef92-e53f-4b79-9486-499f9cdec5e1|0|.0