ASP.NET Calendar - Knowledge Base

« Back to Knowledge Base list

Set date to generic calendar

How to set date to a generic calendar on change of another one?

The OnClientDateChanged event handler can only have the signature DateChange(sender, selecteddate). So if user needs to change the date of another calendar in respect to the selecteddate, he needs to mention the desired calendar in the event handler. To make it generic, user can put an object/array in the global scope of the page, which will contain the mapping of source and destination calendars. In the event handler, checking the sender object with the global mapping object, user then can change the date of the calendar as intended.

For example :

        function DateChange(sender, selecteddate) {
            for (var i = 0; i < calendarMap.length; i++) {
                if (calendarMap[i][0] == sender)


In the global scope of the page add something like the following -
Here calendarMap is a two dimensional array, containing a map of source calendar and destination calendar.

        var calendarMap = new Array();
        calendarMap.push(new Array(myCalendar1, myCalendar2));
        calendarMap.push(new Array(myCalendar2, myCalendar3));