简体   繁体   中英

Jquery or vb.net code for checking future date entered in textbox

I have below code in vb.net.

<tr>
    <td align="right">
        <b>Course Date:</b>
    </td>
    <td>
        <asp:TextBox ID="CourseTimeTextBox" runat="server" Text='<%# Bind("CourseDT") %>' />        
    </td>
</tr>

I want to check at client end whether the entered date in text box is future date. I mean this textbox should allow future date only.

Please provide the code the above problem using jquery or vb.net

You can accomplish client side validation using a combination of two ASP.NET validation controls. CompareValidator and RangeValidator.

<asp:CompareValidator id="CompareValidator1" runat="server" ErrorMessage="CompareValidator" Type="Date" ControlToValidate="TextBox1" Operator="DataTypeCheck" />
<asp:RangeValidator id="RangeValidator1" runat="server" ErrorMessage="RangeValidator" 
MinimumValue="2009-01-01" ControlToValidate="TextBox1" />

Then on the page, on initial load, update the "minimumvalue" property based on the current date.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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