locked
Ajax Calendar Extender End Date > Start date RRS feed

  • Question

  • User496086301 posted

    Aspx:<tr><td>From Date
                    
                    <asp:TextBox ID="TextBox1" runat="server"/>
                    <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/cal.png" />              
                    <asp:CalendarExtender ID="CalendarExtender3" TargetControlID="txtStartDate" Format="MM/dd/yyyy" PopupButtonID="imgbtnCalendar"  runat="server" />                 
               to Date
                    <asp:TextBox ID="TextBox2" runat="server"/>
                    <asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/images/cal.png" />              
                    <asp:CalendarExtender ID="CalendarExtender4" TargetControlID="txtEndDate" Format="MM/dd/yyyy" PopupButtonID="ImageButton1"  runat="server" />   </td>

    How can I validate the to Date to show only future date of From date

    If from date selected is 10/28/13 I want the to date calendar pop up from 10/28/13 or 10/29/13.

    Monday, October 28, 2013 6:49 PM

Answers

  • User-1716253493 posted

    Use CompareValidator

    <asp:CompareValidator ID="CompareValidator1" runat="server"
         ControlToCompare="TextBox1" ControlToValidate="TextBox2" Operator="GreaterThan" 
         ErrorMessage="End Date must greater than StartDate" Type="Date"></asp:CompareValidator>

    Add also RequiredFieldValidator

    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
         ControlToValidate="TextBox1" ErrorMessage="Enter StartDate"></asp:RequiredFieldValidator>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
         ControlToValidate="TextBox2" ErrorMessage="Enter EndDate"></asp:RequiredFieldValidator>


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 28, 2013 8:25 PM

All replies