The Calendar control represents a month calendar with header, footer and content. It provides the ability to display and select ranges of dates.
Use the Calendar.Date property to get or set the control's current date.
The range of selected dates in the Calendar control is stored in its Selection property. You can modify the control's selection by using the methods exposed by the List<T> class.
Use the CalendarStyle property to specify whether the control should display its header, footer and/or navigation buttons.
The calendar control supports three different selection modes as specified in the SelectionMode enumeration.
The following events are exposed by the Calendar class.
Event | Event arguments | Description |
---|---|---|
ValueChangedEventArgs<DateTime> | Raised when the control's date has changed. | |
ValueChangedEventArgs<List<DateTime>> | Raised when the control's selection has changed. |
You can access the control on the client side by its ClientID.
JavaScript
![]() |
---|
var calendar = $find("Calendar1"); |
Use the get_date and set_date methods to get or set the control's date.
JavaScript
![]() |
---|
calendar.set_date(new Date(2012,0,12)); |
Use the getSelection method to retrieve the array with the selected dates in the Calendar. For setting the selection on the client side you can use the select and selectRange methods. The select method accepts as its parameter either a Date object or an Array of Date objects. The selectRange method facilitates range selection by accepting a start and end Date objects. Use the clearSelection method to clear the range of selected dates.
JavaScript
![]() |
---|
// selects the date cell corresponging to 10 June 2012 |
The following client-side event are exposed by the Calendar class.
Event | Event arguments | Script property | Description |
---|---|---|---|
Raised when the control's value has changed. | |||
Raised when the control's selection is about to be changed. | |||
Raised when the control's selection has changed. | |||
Raised when a date cell in a Calendar control is clicked. | |||
- | Raised just after the control has finished loading and is ready for interaction. |