New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

RadCalendar object

The following table lists the most important properties and methods of the ASP NET AJAX Calendar client-side object.

The RadCalendar client object represents dates as 3-element arrays, where the elements represent the year, month, and day, in that order.

The following code snippet demonstrates how to get reference of the client-side object of RadCalendar:

ASP.NET
<telerik:RadCalendar ID="RadCalendar1" runat="server"></telerik:RadCalendar>
<telerik:RadPushButton runat="server" ID="RadButton1" Text="Clear the Calendar" OnClientClicked="getClientReference" AutoPostBack="false" />
<script type="text/javascript">
    function getClientReference() {
        var calendar = $find("<%= RadCalendar1.ClientID %>");
        alert(calendar.get_id()); //returns the element ID
        alert(calendar.get_element()); //returns a reference to the HTML wrapper
    }
</script> 

Properties

NameParametersReturn TypeDescription
get_selectedDatesArray of tripletsReturns an array of triplets that represent the selected dates in the calendar.
get_focusedDateArray (triplet)Returns the triplet that represents the currently focused date. The focused Date is the date that determines which view the calendar displays.
get_rangeMinDateArray (triplet)Returns the triplet that represents the minimum date that can be selected.
set_rangeMinDateArray (triplet)Sets the minimum date that can be selected to the date that the array parameter represents.
get_monthYearNavigationSettingsArrayReturns an array with the fast navigation settings. The settings are, in order, TodayButtonCaption , OkButtonCaption , CancelButtonCaption, DateIsOutOfRangeMessage, EnableTodayButtonSelection. Changes you make to these settings have an effect only if you make them before the first time the month/yearnavigation popup is displayed.
get_calendarEnableMonthYearFastNavigationbooleanReturns whether the month/year navigation popup is enabled.
set_calendarEnableMonthYearFastNavigationbooleanSets whether the month/year navigation popup is enabled.
get_calendarEnableNavigationbooleanReturns whether the navigation buttons appear on the title bar. Setting this property on the client has no effect.
get_orientationintegerReturns 1 if the orientation is "RenderInRows", 2 if it is "RenderInColumns".
get_fastNavigationStepintegerReturns the number of months by which the view changes when the user clicks the fast navigation buttons.
set_fastNavigationStepintegerSets the number of months by which the view changes when the user clicks the fast navigation buttons.
get_multiViewRowsintegerReturns the number of rows when the calendar is in multi-view mode (the number of months in each column).
get_multiViewColumnsintegerReturns the number of columns when the calendar is in multi-view mode (the number of months in each row).
get_singleViewRowsintegerReturns the number of rows in each month view.
get_singleViewColumnsintegerReturns the number of columns in each month view.
get_enableMultiSelectbooleanReturns true if the calendar allows multiple dates to be selected.
set_enableMultiSelectbooleanSets whether the calendar allows multiple dates to be selected.
get_showOtherMonthsDaysbooleanReturns true if the calendar displays days from months other than the focused month.
set_showOtherMonthsDaysbooleanSets whether the calendar displays days from months other than the focused month.
get_specialDaysArrayArrayReturns an array (0-offset)containing information about the special days that are defined. Each element in the array is an array (1-offset) with the following elements (in order): a triplet for the date, four elements that are not used client-side, an indicator of the repeatable status of the special day, another unused element, the tool tip for the day, and array with the style settings for the special day.
get_elementHTML elementGets the DOM element for the calendar.
get_culturestringReturns the RadCalendar culture name.
get_rangeSelectionStartDateDateReturns a triplet that represent the start date of the selected range
get_rangeSelectionEndDateDateReturns a triplet that represent the end date of the selected range
set_datesInRange(startDate, endDate)Date, DateSet selection date range
DateTimeFormatInfoDateTimeFormatInfoThe helper object that the calendar uses for formatting date and time information. You can use this object as well for formatting dates in client-side code.
ASP.NET
<telerik:RadCalendar ID="RadCalendar1" runat="server"></telerik:RadCalendar>
<telerik:RadPushButton runat="server" ID="RadButton1" Text="Unselect the dates before 2025" OnClientClicked="unselectDates" AutoPostBack="false" />
<script>
    function unselectDates(sender, args) {
        var calendar = $find("<%= RadCalendar1.ClientID %>");
        var dates = calendar.get_selectedDates();
        for (var i = 0; i < dates.length; i++) 
        {
            var date = dates[i];
            var year = date[0];
            var month = date[1];
            var day = date[2];
            if (year < 2025)
                calendar.unselectDate(date);
        }
    }
</script>

Methods

NameParametersReturn TypeDescription
selectDateArray (triplet), booleanSelects the date represented by the triplet that is the first parameter. If the second parameter is true , the calendar navigates to the view containing the newly selected date (see sample below).
selectDatesArray, booleanSelects the set of dates in the first parameter, where each date is represented by triplet.If the second parameter is true , the calendar navigates to the view containingthe newly selected dates (see sample below).
unselectDateArray (triplet)Unselects the date represented by the parameter if it is currently selected (see sample below).
unselectDatesArray of tripletsUn-selects all the dates represented by triplets in the array if they are currently selected (see sample below).
navigateToDateArray (triplet)Causes the calendar to switch to the view containing the specified date (see sample below).
calculateDateFromStepintegerArray (triplet)Returns the triplet for the date that is offset by the specified number of days from the current month.If the parameter is positive, the days are offset from the last day of the month. If the parameter is negative,the days are offset from the first day of the month (see sample below).
JavaScript
<telerik:RadCalendar ID="RadCalendar1" runat="server"></telerik:RadCalendar>
<telerik:RadPushButton runat="server" ID="RadButton1" Text="Select Today" OnClientClicked="SelectToday" AutoPostBack="false" />
<script type="text/javascript">
    function SelectToday() {
        var todaysDate = new Date();
        var todayTriplet = [todaysDate.getFullYear(), todaysDate.getMonth() + 1, todaysDate.getDate()];
        var calendar = $find("<%=RadCalendar1.ClientID%>");
        calendar.selectDate(todayTriplet, true);
    }
</script>
ASP.NET
<telerik:RadCalendar ID="RadCalendar1" runat="server"></telerik:RadCalendar>
<telerik:RadPushButton runat="server" ID="RadButton1" Text="Select Today And Tomorrow" OnClientClicked="selectTodayAndTomorrow" AutoPostBack="false" />
<script>
    function selectTodayAndTomorrow() {
        var todaysDate = new Date();
        var todayTriplet = [todaysDate.getFullYear(), todaysDate.getMonth() + 1, todaysDate.getDate()];
        var tomorrowTriplet = [todaysDate.getFullYear(), todaysDate.getMonth() + 1, todaysDate.getDate() + 1];
        var selectedDates = [todayTriplet, tomorrowTriplet];

        var calendar = $find("<%=RadCalendar1.ClientID%>");
        calendar.selectDates(selectedDates, true);
    }
</script>
ASP.NET
<telerik:RadCalendar ID="RadCalendar1" runat="server"></telerik:RadCalendar>
<telerik:RadPushButton runat="server" ID="RadButton1" Text="Unselect Today" OnClientClicked="UnselectToday" AutoPostBack="false" />
<script type="text/javascript">
    function UnselectToday() {
        var todaysDate = new Date();
        var todayTriplet = [todaysDate.getFullYear(), todaysDate.getMonth() + 1, todaysDate.getDate()];
        var calendar = $find("<%=RadCalendar1.ClientID%>");
        calendar.unselectDate(todayTriplet);
    }		
</script>		
ASP.NET
<telerik:RadCalendar ID="RadCalendar1" runat="server"></telerik:RadCalendar>
<telerik:RadPushButton runat="server" ID="RadButton1" Text="Clear the Calendar" OnClientClicked="clearCalendar" AutoPostBack="false" />
<script type="text/javascript">
    function clearCalendar() {
        var calendar = $find("<%= RadCalendar1.ClientID %>");
        var dates = calendar.get_selectedDates();
        calendar.unselectDates(dates);
    }
</script> 	
ASP.NET
<telerik:RadCalendar ID="RadCalendar1" runat="server"></telerik:RadCalendar>
<telerik:RadPushButton runat="server" ID="RadButton1" Text="Go To Summer Of Love" OnClientClicked="goToSummerOfLove" AutoPostBack="false" />
<script type="text/javascript">
    function goToSummerOfLove() {
        var triplet = [1968, 6, 1];
        var calendar = $find("<%=RadCalendar1.ClientID%>");
        calendar.set_rangeMinDate([1960, 1, 1]);
        calendar.navigateToDate(triplet);
    }
</script>
ASP.NET
<telerik:RadCalendar ID="RadCalendar1" runat="server"></telerik:RadCalendar>
<telerik:RadPushButton runat="server" ID="RadButton1" Text="Go Forward Six Months" OnClientClicked="goForwardSixMonths" AutoPostBack="false" />
<script type="text/javascript">
    function goForwardSixMonths() {
        var calendar = $find("<%=RadCalendar1.ClientID%>");
        var target = calendar.calculateDateFromStep(183);
        calendar.navigateToDate(target);
    }
</script>	

See Also

In this article
PropertiesMethodsSee Also
Not finding the help you need?
Contact Support