This is a migrated thread and some comments may be shown as answers.

custom Fast Navigation not working

1 Answer 60 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
kasi
Top achievements
Rank 1
kasi asked on 07 Jul 2011, 11:22 AM
Hi ,
I m using RadCalendar which is a MultiViewRows , and I am navigating Some Custom Date Selection when we click the Fast navigation. I using Client Side event but it throws Date2 must be array: [y, m, d]. Here below i show my code , please suggest me where is error.

<telerik:RadCalendar runat="server" Skin="Windows7" ID="RadCalendar1" AutoPostBack="true"
                                       TitleFormat="MMM-yy" EnableMultiSelect="false" MultiViewRows="3" MultiViewColumns="1"
                                       PresentationType="Interactive" HideNavigationControls="true" DayNameFormat="FirstTwoLetters"
                                       ShowOtherMonthsDays="false" FastNavigationStep="1" EnableNavigation="true" EnableMonthYearFastNavigation="False">
                                       <ClientEvents OnCalendarViewChanged="CheckSelections" />
                                   </telerik:RadCalendar>
function CheckSelections(sender, eventArgs) {
            var selDates = sender.get_selectedDates();
            var calendar = $find("<%=RadCalendar1.ClientID%>");
            var dates = calendar.get_selectedDates()
            var date = dates[0]
            var year = date[0];
            var month = date[1];
            var day = date[2]
            var mydate = month + "/" + day + "/" + year
            mydate = DateAdd(mydate, "M", 1); 
            var datearray = mydate.format("yyyy, M, d");
            var arr = [datearray];
            calendar.selectDate(arr,true);  
        }

1 Answer, 1 is accepted

Sort by
0
Genti
Telerik team
answered on 11 Jul 2011, 04:35 PM
Hi Kasi,

Thank you for contacting us.

Let's suppose the following:
-You select one date, then the calendar is going to postback and store this date in the ViewState.
-Then when you try to get to the next view, set again this date with the function selectDate().
-This makes the Calendar switch the view again to the same page where the selected date was.
So, you cannot change your view.

What is the purpose of this code?

If you want to use the selectDates function make sure the array that you pass is as following:
var arr = [[year, month, day]];
otherwise if you use the selectDate function it should be:
var arr = [year, month, day];

Hope this helps.

Greetings,
Genti
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Calendar
Asked by
kasi
Top achievements
Rank 1
Answers by
Genti
Telerik team
Share this question
or