ASP.NET Calendar 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, allowing users to select a date and also jump to the previous or next month.
Properties
Properties | Description | .NET |
---|---|---|
Caption | The title of the calendar. | 2.0 |
CaptionAlign | The alignment of the calendar title text. | 2.0 |
CellPadding | 单元格边框与内容之间的空白,以像素计。 | 1.0 |
CellSpacing | The space between the cell border and the content, in pixels. | 1.0 |
CellSpacing | The space between cells, in pixels. | 1.0 |
DayHeaderStyle | The style of the name of a specific day in the week. | 1.0 |
DayNameFormat | The format of the names of the days in the week. | 1.0 |
DayStyle | The style of the displayed date. | 1.0 |
FirstDayOfWeek | Which day is the first day of the week. | 1.0 |
The text displayed for the link to the next month. | NextPrevFormat | 1.0 |
The format of the links to the next and previous month. | NextPrevStyle | 1.0 |
The style of the links to the next and previous month. | OtherMonthDayStyle | 1.0 |
The style of the dates that are not in the current month. | PrevMonthText | 1.0 |
The text displayed for the link to the previous month. | runat | 1.0 |
Specifies that the control is a server control. Must be set to "server". | SelectedDates | 1.0 |
SelectedDate | SelectedDates | 1.0 |
The selected date. | SelectedDayStyle | 1.0 |
The style of the selected dates. | SelectionMode | 1.0 |
How the user is allowed to select dates. | The text displayed for the selection link to the month. | 1.0 |
SelectorStyle | The style of the selection links for month and week. | 1.0 |
SelectWeekText | The text displayed for the selection link to the week. | 1.0 |
ShowDayHeader | Boolean value, indicating whether to display headers for each day of the week. | 1.0 |
ShowGridLines | Boolean value, specifying whether to display grid lines between dates. | 1.0 |
ShowNextPrevMonth | Boolean value, specifying whether to display the links to the next and previous month. | 1.0 |
ShowTitle | Boolean value, specifying 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 the current day's date. | 1.0 |
TodaysDate | Get or set the value of today's date. | 1.0 |
UseAccessibleHeader | Whether to use <th> instead of <td> elements for the day header. | 2.0 |
VisibleDate | Get or set the date of the specified month to be displayed 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 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.
Control Standard Properties
AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site TemplateControl, TemplateSourceDirectory, UniqueID, Visible
For a complete description, please visitControl Standard Properties.
Example
- Calendar
- In this example, we declare the simplest Calendar control in the .aspx file.
- Calendar 2
- In this example, we declare a Calendar control in the .aspx file. Dates are displayed with their full names in blue, weekends are displayed with 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 the .aspx file. Dates are displayed with their full names, and users can select a day, a week, or the entire month. The selected day/week/month is displayed with a gray background color.