ASP.NET Calendar Control
Web Server Controls
Definition and Usage
The Calendar control is used to display a calendar in the browser.
This control can display a one-month calendar, allowing users to select dates and navigate to the previous or next month.
property
| property | Description | .NET | ||
|---|---|---|---|---|
| Caption | The title of the calendar. | 2.0 | ||
| CaptionAlign | The alignment of the calendar title text. | 2.0 | ||
| CellPadding | The space, in pixels, between the cell border and its content. | 1.0 | ||
| CellSpacing | The space, in pixels, between cells. | 1.0 | ||
| DayHeaderStyle | The style used to display the names of the days of the week. | 1.0 | ||
| DayNameFormat | The format used to display the names of the days of the week. | 1.0 | ||
| DayStyle | The style used to display dates. | 1.0 | ||
| FirstDayOfWeek | Which day is the first day of the week. | 1.0 | ||
| NextMonthText | The text of the link that displays the next month. | 1.0 | ||
| NextPrevFormat | The format of the next-month and previous-month links. | 1.0 | ||
| NextPrevStyle | The style of the next-month and previous-month links. | 1.0 | ||
| OtherMonthDayStyle | The style used to display dates that are not in the current month. | 1.0 | ||
| PrevMonthText | The text of the link that displays the previous month. | 1.0 | ||
| runat | Specifies that the control is a server control. Must be set to "server". | 1.0 | ||
| SelectedDate | The selected date. | 1.0 | ||
| SelectedDates | The selected date. | 1.0 | ||
| SelectedDayStyle | The style of the selected date. | 1.0 | ||
| SelectionMode | Allows the user to choose how to select dates. | 1.0 | ||
| SelectMonthText | The text displayed as the month-selection link. | 1.0 | ||
| SelectorStyle | The style of the month- and week-selection links. | 1.0 | ||
| SelectWeekText | The text displayed as the week-selection link. | 1.0 | ||
| ShowDayHeader | A Boolean value that indicates whether to display the header for the days 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-month and previous-month links. | 1.0 | ||
| ShowTitle | A Boolean value that specifies whether to display the date title. | 1.0 | ||
| TitleFormat | The format of the date title. | 1.0 | ||
| TitleStyle | The style of the date 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 | instead of | element is used for the day header. | 2.0 |
| VisibleDate | Gets or sets the date that specifies the month to display on the Calendar control. | 1.0 | ||
| WeekendDayStyle | The style of weekends. | 1.0 | ||
| OnDayRender | The name of the function executed when each day's cell is created. | |||
| OnSelectionChanged | The name of the function executed when the user selects a day, week, or month. | |||
| OnVisibleMonthChanged | The name of the function executed 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 complete description, please visit Web Control Standard Properties。
Web Control Standard Properties
AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible
For a complete description, please visit Web Control Standard Properties。
Try it - Example
Calendar
In this example, we declare the simplest possible Calendar control in the .aspx file.
Calendar 2
In this example, we declare a Calendar control in the .aspx file. Dates are displayed in blue full names, weekends in yellow background with red text, and the current date with a green background.
Calendar 3
In this example, we declare a Calendar control in the .aspx file. Dates are displayed in full names; the user can select a day, a week, or a whole month, and the selected day/week/month is displayed with a gray background.
Web Server Controls