📄 example2.aspx
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Example2.aspx.cs" Inherits="Example2" %>
<%@ Register Src="Date.ascx" TagName="Date" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Example 2</title>
<link href="cal/popcalendar.css" type="text/css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>Example 2: Using Validators</h2>
<p>
Please choose a date in January 2008:
<uc1:Date ID="Date1" runat="server" />
</p>
<p>
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="Date1"
ErrorMessage="Wrong date, enter a date between 01.01.2008 and 31.01.2008!" MaximumValue="31.01.2008"
MinimumValue="01.01.2008" Type="Date" Display="Dynamic" SetFocusOnError="True"></asp:RangeValidator><asp:RequiredFieldValidator
ID="RequiredFieldValidator1" runat="server" ControlToValidate="Date1" Display="Dynamic"
ErrorMessage="A date must be selected."></asp:RequiredFieldValidator> </p>
<p>
<asp:Button ID="cmdSubmit" runat="server" OnClick="cmdSubmit_Click" Text="Submit" /> </p>
<p>
<asp:Label ID="lblResult" runat="server"></asp:Label> </p>
<p>
This example uses a <span style="font-size: 11pt; color: blue; font-family: Courier New">
<strong>RequiredFieldValidator</strong></span> to catch empty values and a <span
style="font-size: 11pt; color: blue; font-family: Courier New"><strong>RangeValidator</strong></span>
to verify whether the selected date is within January 2008. Note that the property
<strong><span style="font-size: 11pt; color: blue; font-family: Courier New">ControlToValidate</span></strong>
of the validator controls will not list the date picker control. This appears to
be a bug of Visual Studio. Just enter the
control ID ("Date1" in our example) by
hand.</p>
<p>
<a href="Default.aspx">Back</a></p>
</div>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -