0

I have to Date Field one is From Date and another one is To Date i want to set To date as if From Date is suppose 01/01/2021 then max Date of To Date should be 01/01/2022. I am not able to Do the same Please help me

Function:

 function FromDateValidate() {
            var selToDate = deToDate.GetDate();
            if (deToDate.GetDate() == null || deToDate.GetDate() == '') {
                deToDate.SetMinDate(selFromDate);

                deToDate.SetMaxDate(new Date(deFromDate + 365)); //To date hide all date 
                //var Fromdate = deFromDate.GetDate();  
                //deToDate.SetDate(new Date(Fromdate.setDate(Fromdate.getDate() + 365))); Not working
            }
            var selFromDate = deFromDate.GetDate();
            if (selFromDate > selToDate) {
                deToDate.SetDate(selFromDate);
                deToDate.SetMinDate(selFromDate);
            }
        }

        function ToDateValidate() {
            if (deFromDate.GetDate() == null || deFromDate.GetDate() == '') {
                var selToDate = deToDate.GetDate();
                var selFromDate = deFromDate.GetDate();
                deFromDate.SetMaxDate(selToDate);
            }
            if (selFromDate > selToDate) {
                deToDate.SetDate(selFromDate);
                deToDate.SetMinDate(selFromDate);
            }
        }

AspxDateEdit :

  <dx:ASPxDateEdit CssClass="date" ID="deFromDate" runat="server" Width="131px" AllowUserInput="False" Height="25px"
   EditFormatString="dd-MMM-yyyy" DisplayFormatString="dd-MMM-yyyy" EditFormat="Custom"
   Theme="Office2003Blue" ClientInstanceName="deFromDate" OnInit="deFromDate_Init">
     <ClientSideEvents DateChanged="function(s, e) {
                        FromDateValidate();
                    }" />
 </dx:ASPxDateEdit>
 <dx:ASPxDateEdit CssClass="date" ID="deToDate" runat="server" Width="131px" AllowUserInput="False" Height="25px"
 EditFormatString="dd-MMM-yyyy" DisplayFormatString="dd-MMM-yyyy" EditFormat="Custom"
 Theme="Office2003Blue" ClientInstanceName="deToDate" OnInit="deToDate_Init">
 <ClientSideEvents DateChanged="function(s, e) {
                       ToDateValidate();
                   }" />
  </dx:ASPxDateEdit>
                                                          
2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.