rangevalidator

代码:

<!DOCTYPE html>

<html>

<body>

 

<form runat="server">

Enter a date between 2005-01-01 and 2005-12-31:

<br>

<asp:TextBox id="tbox1" runat="server" />

<br><br>

<asp:Button Text="Submit" runat="server" />

<br><br>

<asp:RangeValidator

ControlToValidate="tbox1"

MinimumValue="2005-01-01"

MaximumValue="2005-12-31"

Type="Date"

EnableClientScript="false"

Text="The date must be between 2005-01-01 and 2005-12-31!"

runat="server" />

</form>

 

</body>

</html>

结果:

相关文章