ASP.NET CalendarControl


Web Server ControlsWeb Server Control

Definition and Usage

The Calendar control is used to display a calendar in a browser.

This control can display a calendar for a month, allow the user to select a date, and can also jump to the previous or next month.


Properties

Property Description .NET
Caption The title of the calendar. 2.0
CaptionAlign The alignment of the calendar title text. 2.0
CellPadding The space between the cell border and its contents, in pixels. 1.0
CellSpacing The space between cells, in pixels. 1.0
DayHeaderStyle The style for displaying the names of the days of the week. 1.0
DayNameFormat The format for displaying the names of the days of the week. 1.0
DayStyle The style for displaying dates. 1.0
FirstDayOfWeek Which day is the first day of the week. 1.0
NextMonthText The text for displaying the next month link. 1.0
NextPrevFormat The format for the next and previous month links. 1.0
NextPrevStyle The style for displaying the next and previous month links. 1.0
OtherMonthDayStyle The style for displaying dates that are not in the current month. 1.0
PrevMonthText The text for displaying the previous month link. 1.0
runat Specifies that this control is a server control. Must be set to "server". 1.0
SelectedDate The selected date. 1.0
SelectedDates The selected dates. 1.0
SelectedDayStyle The style for the selected date. 1.0
SelectionMode How the user is allowed to select dates. 1.0
SelectMonthText The text displayed for the month selection link. 1.0
SelectorStyle The style for the month and week selection links. 1.0
SelectWeekText The text displayed for the week selection link. 1.0
ShowDayHeader A Boolean value that indicates whether to display the day headers of the week. 1.0
ShowGridLines A Boolean value that specifies whether to display grid lines between dates. 1.0
ShowNextPrevMonth A Boolean value that specifies whether to display the next and previous month links. 1.0
ShowTitle A Boolean value that specifies whether to display the calendar title. 1.0
TitleFormat The format of the calendar title. 1.0
TitleStyle The style of the calendar title. 1.0
TodayDayStyle The style of today's date. 1.0
TodaysDate Gets or sets the value of today's date. 1.0
UseAccessibleHeader Specifies whether to use <th> instead of <td> elements for the day headers. 2.0
VisibleDate Gets or sets the date that specifies the month to display on the Calendar control. 1.0
WeekendDayStyle The style for weekends. 1.0
OnDayRender The name of the function to execute when each day's cell is created.
OnSelectionChanged The name of the function to execute when the user selects a day, week, or month.
OnVisibleMonthChanged The name of the function to execute when the user navigates to a different month.

Web Control Standard Properties

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth, CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled, SkinID, Style, TabIndex, ToolTip, Width

For a full description, visitWeb Control Standard Properties。

Control Standard Properties

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible

For a full description, visitControl Standard Properties。


Examples

Try it Yourself - Examples

Calendar
In this example, we declare a Calendar control with the simplest usage in an .aspx file.

Calendar 2
In this example, we declare a Calendar control in an .aspx file. Dates are displayed as full names in blue, weekends are displayed with a yellow background and red text, and the current date is displayed with a green background.

Calendar 3
In this example, we declare a Calendar control in an .aspx file. Dates are displayed as full names. The user can select a day, a week, or an entire month. The selected day/week/month is displayed with a gray background color.


Web Server ControlsWeb Server Control Other Extensions