customvalidatormain.aspx
来自「csharp课本的源代码」· ASPX 代码 · 共 28 行
ASPX
28 行
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomValidatorMain.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>CustomValidator控件示例</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
请输入一个偶数:<asp:TextBox ID="textBoxInput" runat="server"></asp:TextBox>
<br />
<asp:RegularExpressionValidator ID="regularExpressionValidator" runat="server" ControlToValidate="textBoxInput"
ErrorMessage="必须输入数字" ValidationExpression="(\d)*"></asp:RegularExpressionValidator>
<asp:CustomValidator ID="customValidatorEven" runat="server" ControlToValidate="textBoxInput"
ErrorMessage="必须输入偶数" OnServerValidate="customValidatorEven_ServerValidate"></asp:CustomValidator><br />
<asp:Button ID="buttonOK" runat="server" Height="29px" OnClick="OKButton_Click" Text="确 定"
Width="79px" />
</div>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?