applyvalidationsummary.aspx
来自「asp.net专家200问(含源代码解决法案」· ASPX 代码 · 共 105 行
ASPX
105 行
<%@ Page language="c#" Codebehind="ApplyValidationSummary.aspx.cs" AutoEventWireup="false" Inherits="ApplyValidationSummary.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
</HEAD>
<body>
<h3><font face="宋体">ValidationSummary 示例</font></h3>
<p>
<form runat="server" ID="Form1">
<table cellpadding="10">
<tr>
<td>
<table bgcolor="#eeeeee" cellpadding="10">
<tr>
<td colspan="3">
<font face="宋体" size="2"><b>信用卡信息</b></font>
</td>
</tr>
<tr>
<td align="right">
<font face="宋体" size="2">卡类型:</font>
</td>
<td>
<ASP:RadioButtonList id="RadioButtonList1" 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="RequiredFieldValidator1" ControlToValidate="RadioButtonList1" ErrorMessage="卡类型。" Display="Static" InitialValue="" Width="100%" runat="server">
*
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<font face="宋体" size="2">卡号:</font>
</td>
<td>
<ASP:TextBox id="TextBox1" runat="server" />
</td>
<td>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" ControlToValidate="TextBox1" ErrorMessage="卡号。" Display="Static" Width="100%" runat="server">
*
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<font face="宋体" size="2">到期日期:</font>
</td>
<td>
<ASP:DropDownList id="DropDownList1" runat="server">
<asp:ListItem></asp:ListItem>
<asp:ListItem>01/01</asp:ListItem>
<asp:ListItem>02/01</asp:ListItem>
<asp:ListItem>03/01</asp:ListItem>
<asp:ListItem>04/01</asp:ListItem>
<asp:ListItem>05/01</asp:ListItem>
<asp:ListItem>06/01</asp:ListItem>
<asp:ListItem>07/01</asp:ListItem>
<asp:ListItem>08/01</asp:ListItem>
<asp:ListItem>09/01</asp:ListItem>
<asp:ListItem>10/01</asp:ListItem>
<asp:ListItem>11/01</asp:ListItem>
<asp:ListItem>12/01</asp:ListItem>
</ASP:DropDownList>
</td>
<td>
<asp:RequiredFieldValidator id="RequiredFieldValidator3" ControlToValidate="DropDownList1" ErrorMessage="失效日期。" Display="Static" InitialValue="" Width="100%" runat="server">
*
</asp:RequiredFieldValidator>
</td>
<td></td>
<tr>
<td></td>
<td>
<ASP:Button id="Button1" text="验证" runat="server" />
</td>
<td></td>
</tr>
</table>
</td>
<td valign="top">
<table cellpadding="20">
<tr>
<td>
<asp:ValidationSummary ID="valSum" runat="server" HeaderText="必须在下列字段中输入值:" Font-Name="verdana" Font-Size="12" ShowMessageBox="True" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<font face="宋体" size="-1">选择所需的验证摘要显示类型:</font>
<asp:DropDownList id="ListFormat" AutoPostBack="true" runat="server">
<asp:ListItem>列表</asp:ListItem>
<asp:ListItem selected="True">项目符号列表</asp:ListItem>
<asp:ListItem>单独一段</asp:ListItem>
</asp:DropDownList>
</form>
</p>
</body>
</HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?