Set RadCalender Focus date on OnCalendarViewChanged Event Problem

1 posts, 0 answers
  1. Nishanth
    Nishanth avatar
    5 posts
    Member since:
    Mar 2012

    Posted 25 Mar 2013 Link to this post

    Hi,
         In my project am using two rad calendars with id 'CalendarSelectorOne' and 'CalendarSelectorTwo'. I want to set focused date of 'CalendarSelectorTwo' when 'CalendarSelectorOne' view changes on 'OnCalendarViewChanged' event. Below is my code how am using in project

    aspx code:
          <rad:RadCalendar ID="CalendarSelectorOne" EnableMultiSelect="false" runat="server"
                            Skin="Black" EnableNavigation="true" EnableMonthYearFastNavigation="true">
                            <ClientEvents OnDateSelected="OnCalendar1DateSelected"
                                OnCalendarViewChanged="OnCalendar1ViewChanged" />
          </rad:RadCalendar>

           
         <rad:RadCalendar ID="CalendarSelectorTwo" EnableMultiSelect="false" runat="server"
                            Skin="Black" EnableNavigation="false" EnableMonthYearFastNavigation="false">
                            <ClientEvents OnDateSelected="OnCalendar1DateSelected" />
           </rad:RadCalendar>


    Javascript Code:
       
              var calendarone;
              var calendartwo;
              function pageLoad(sender, args) {
                    calendarone = $find('<%=CalendarSelectorOne.ClientID %>');
                    calendartwo = $find('<%=CalendarSelectorTwo.ClientID %>');             
                }

            function OnCalendar1ViewChanged(sender, eventArgs) {
                    var dateTriplet = sender.get_focusedDate();   
                        var selectedDate = new Date(dateTriplet[0], dateTriplet[1] - 1, dateTriplet[2]);
                        var calendar2 = new Date(dateTriplet[0], dateTriplet[1], dateTriplet[2]);
                        calendartwo.set_focusedDate(calendar2);  
                   
                }


        In OnCalendar1ViewChanged event am getting 'CalendarSelectorOne' focused date and add one month from that date and seeting focused date to  'CalendarSelectorTwo' calendar. But its not changing the view of the second calendar.

        Please let us know am doing any wrong in this.


    Regards,
    Nishanth P

Back to Top