Search Results

Search found 1 results on 1 pages for 'sahanr'.

Page 1/1 | 1 

  • Date Compare Validator Control ASP.NET

    - by Sahanr
    Compare two input dates to avoid invalid dates. In this example I have created two textboxes and namded as "TextBoxSeminarDate" and "TextBoxBookingDeadline". Booking deadline date must be before date to the Seminar date. Therefore I used Operator as "LesThanEqual". I have validated "TextBoxBookingDeadline" value comparing with the "TextBoxSeminarDate" value as follow.   <asp:CompareValidator ID="CompareValidatorBookingDeadline" runat="server" ControlToCompare="TextBoxSeminarDate" ControlToValidate="TextBoxBookingDeadline" Display="Dynamic" ErrorMessage="Please check the seminar date and select appropriate date for booking deadline" Operator="LessThanEqual" Type="Date"  ValueToCompare="<%= TextBoxSeminarDate.Text.ToShortString() %>">*</asp:CompareValidator> The important thing is "ValueToCompare" property of the compare validator. Here I have assined it to the value of the TextboxSeminarDate and then compered it with the booking deadline date.  

    Read the article

1