webform1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="work041.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>验证摘要汇总控件</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table border="1">
<caption>活动申请表</caption>
<tr>
<td>开始时间</td>
<td>
<asp:TextBox ID="txtStart" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="请填开始时间" ControlToValidate="txtStart" Display="None"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="开始时间格式不正确" ControlToValidate="txtStart" MinimumValue="0001-01-01" MaximumValue="9999-12-31" Display="None" ></asp:RangeValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="开始时间不能晚于结束时间" ControlToValidate="txtStart" ControlToCompare="txtEnd" Type="Date" Operator="LessThanEqual" Display="None"></asp:CompareValidator>
</td>
</tr>
<tr>
<td>结束时间</td>
<td>
<asp:TextBox ID="txtEnd" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="请填结束时间" ControlToValidate="txtEnd" Display="None"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="结束时间格式不正确" ControlToValidate="txtEnd" MinimumValue="0001-01-01" MaximumValue="9999-12-31" Display="None"></asp:RangeValidator>
<asp:CompareValidator ID="CompareValidator3" runat="server" ErrorMessage="结束时间不能早于开始时间" ControlToValidate="txtEnd" ControlToCompare="txtStart" Type="Date" Operator="GreaterThanEqual" Display="None"></asp:CompareValidator>
</td>
</tr>
<tr>
<td>参加人数</td>
<td>
<asp:TextBox ID="txtNum" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="请填人数" ControlToValidate="txtNum" Display="None"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="人员大于0" ControlToValidate="txtNum" ValueToCompare="0" Type="Integer" Operator="GreaterThan" Display="None"></asp:CompareValidator>
</td>
</tr>
<tr>
<td>经费预算</td>
<td>
<asp:TextBox ID="txtMoney" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="请填经费" ControlToValidate="txtMoney" Display="None"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator4" runat="server" ErrorMessage="经费大于0" ControlToValidate="txtMoney" ValueToCompare="0.0" Operator="GreaterThan" Display="None"></asp:CompareValidator>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="Button1" runat="server" Text="提交" />
</td>
</tr>
</table>
</div>
<div>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="BulletList" ShowSummary="true" ShowMessageBox="false" />
</div>
</form>
</body>
</html>
webform1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace work041
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Page.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
}
}
}