tags:

views:

198

answers:

1

Hi,

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

A: 

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.

Mitchel Sellers