开发者

date validation

I have a textbox which is used to enter the date.Now when the user ent开发者_如何学运维ers the date in the specified format I have to validate at client side itself,if user gives other than the current date.(current date is the "actual date" when the user makes the entry)


<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>

try above code. it validate date in client side.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜