Calendar control
ASP.NET Calendar Control
Web server control
Definition and usage
Calendar control to display the calendar in the browser.
This control can display a calendar for a certain month, allowing the user to select a date, or jump to the previous or next month.
Properties
Properties | Description | .NET |
---|---|---|
Caption | The title of the calendar. | 2.0 |
CaptionAlign | Alignment of the calendar title text. | 2.0 |
CellPadding | The space, in pixels, between the cell border and the content. | 1.0 |
CellSpacing | The spacing between cells, in pixels. | 1.0 |
DayHeaderStyle | The style that displays the names of the days of the week. | 1.0 |
DayNameFormat | The format that displays the names of the days of the week. | 1.0 |
DayStyle | The style of displaying the date. | 1.0 |
FirstDayOfWeek | Which day is the first day of the week. | 1.0 |
NextMonthText | Displays the text of the next month link. | 1.0 |
NextPrevFormat | Format of next month and previous month links. | 1.0 |
NextPrevStyle | Displays the style of the next month and previous month links. | 1.0 |
OtherMonthDayStyle | The style that displays dates that are not in the current month. | 1.0 |
PrevMonthText | Displays the text of the previous month link. | 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 | Selected dates. | 1.0 |
SelectedDayStyle | The style of the selected date. | 1.0 |
SelectionMode | Allows how the user selects dates. | 1.0 |
SelectMonthText | The text displayed for the month selection link. | 1.0 |
SelectorStyle | The style of the month and week selection link. | 1.0 |
SelectWeekText | The text that displays the select link for the week. | 1.0 |
ShowDayHeader | Boolean value indicating whether to display headers for each day of the week. | 1.0 |
ShowGridLines | Boolean value, specifies whether to display grid lines between dates. | 1.0 |
ShowNextPrevMonth | Boolean value, specifies whether to display the next month and previous month links. | 1.0 |
ShowTitle | Boolean value, specifies whether to display the title of the date. | 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 <th> instead of <td> elements for day headers. | 2.0 |
VisibleDate | Gets or sets the day of the month specified to be displayed on the Calendar control. | 1.0 |
WeekendDayStyle | Weekend style. | 1.0 |
OnDayRender | The name of the function that is 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 that is executed when the user navigates to a different month. |
Web control standard properties
For a complete description, visit Web Control Standard Properties.
Control standard properties
For a complete description, please visit Control Standard Properties.
Try it - Example
Calendar
In this example, we declare the simplest one in the .aspx file Calendar control.
Calendar 2
In this example, we declare a Calendar control in the .aspx file. The date is shown with the full name in blue, weekends are shown with red text on a yellow background, and the current date is shown with a green background.
Calendar 3
In this example, we declare a Calendar control in the .aspx file. The date is displayed with its full name, and the user can select a day, week, or entire month. The selected day/week/month is displayed with a gray background color.
Web Server Control