RadCalendar Client Navigation Event Occurring Continuously

2 posts, 0 answers
  1. kasi
    kasi avatar
    29 posts
    Member since:
    May 2011

    Posted 07 Jul 2011 Link to this post

    Hi,
    I created Sample Calendar Event With Multiple Views (1cloumn, 3 Rows) , if i click slow navigation (>) button it moves after 3 months , i want to just move one month , that month should show in top , Is any property available in Rad Calendar , it would seems to outlook calendar 2007 design ..  i created custom navigation , the selected date is disappears after click the slow navigation button , the event fires continuously. Please Look my code and can give me the best solution and looking help from you
    <telerik:RadScriptBlock ID="idRSB" runat="server">
            <script type="text/javascript" language="javascript">
                function CheckSelections(sender, eventArgs) {
                    //debugger;
                    //var dates = sender.get_selectedDates();
                    var minDate = sender.get_rangeMinDate();
                    var maxDate = sender.get_rangeMaxDate();
                    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 datearray = "2011,08,16"               
                    var arr = datearray.split(",")
                    calendar.selectDate(arr, true);
                    
             }          
            </script>
        </telerik:RadScriptBlock>
        <div>
            <telerik:RadScriptManager ID="RadScriptManager" runat="server" />
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadCalendar1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar1"></telerik:AjaxUpdatedControl>
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadCalendar ID="RadCalendar1" runat="server" AutoPostBack="true" MultiViewColumns="1"
                MultiViewRows="3" EnableMultiSelect="false" RangeMaxDate="2100/01/01" RangeMinDate="1965/01/01">
                <ClientEvents OnCalendarViewChanged="CheckSelections" />
            </telerik:RadCalendar>
    .
  2. Vasil
    Admin
    Vasil avatar
    1638 posts

    Posted 13 Jul 2011 Link to this post

    Hi Kasi,

    For changing with one view you could cancel the CalendarViewChanging client event of the Calendar when step is 3 months and then navigate it with one month.

    JS:
    function CalendarViewChanging(sender, eventArgs)
     {
       if (eventArgs.get_step() == 3)
       {
         eventArgs.set_cancel(true);
         sender._navigate(1);
       }
       if (eventArgs.get_step() == -3)
       {
         eventArgs.set_cancel(true);
         sender._navigate(-1);
       }
     }

    I hope this helps.

    All the best,
    Vasil
    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!

Back to Top