繁体   English   中英

日期验证

[英]date validation

我有一个用于输入日期的文本框。现在,当用户以指定格式输入日期时,如果用户输入的不是当前日期,我必须在客户端本身进行验证。(当前日期是“实际日期”用户输入时)

<form id="form1" runat="server">
    <div>
    <table id="table1" runat="server" border="0" cellpadding="1" cellspacing="2">
    <tr>
    <td>
    <asp:Label id="lblDate" Text="Date" AssociatedControlID="txtDate" runat="server"></asp:Label>
    </td>
    <td>
    <asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
    <asp:CompareValidator id="cmprDate" Text="(Invalid Date)" ControlToValidate="txtDate" Type="Date" Operator="DataTypeCheck" runat="server"></asp:CompareValidator>
    </td>
    </tr>
    </table>

    </div>
    </form>

尝试上面的代码。 它在客户端验证日期。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM