The Calendar control is used to display a calendar in the browser.
This control displays a one-month calendar that allows the user to select
dates and move to the next and previous months.
Property |
Description |
CellPadding |
The space, in pixels, between the cell walls and contents |
CellSpacing |
The space, in pixels, between cells |
DayHeaderStyle |
The style for displaying the names of the days |
DayNameFormat |
The format for displaying the names of the days. Can take
one of the following values:
- FirstLetter
- FirstTwoLetters
- Full
- Short
|
DayStyle |
The style for displaying days |
FirstDayOfWeek |
What should be the first day of week. Can take one of the
following values:
- Default
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
- Saturday
- Sunday
|
id |
A unique id for the control |
NextMonthText |
The text displayed for the next month link |
NextPrevFormat |
The format of the next and previous month links. Can take
one of the following values:
- ShortMonth
- FullMonth
- CustomText
|
NextPrevStyle |
The style for displaying next and previous month links |
OnDayRender |
The name of the function to be executed when when each day cell is created |
OnSelectionChanged |
The name of the function to be executed when the user selects a day, week, or month |
OnVisibleMonthChanged |
The name of the function to be executed when the user navigates to a different month |
OtherMonthDayStyle |
The style for displaying days that are not in the current
month |
PrevMonthText |
The text displayed for the previous month link |
runat |
Specifies that the control is a server control. Must
be set to "server" |
SelectedDate |
The selected date |
SelectedDates |
The selected dates |
SelectedDayStyle |
The style for selected days |
SelectionMode |
How a user is allowed to select dates. Can take one of the
following values:
- None
- Day
- DayWeek
- DayWeekMonth
|
SelectMonthText |
The text displayed for the month selection link |
SelectorStyle |
The style for the month and weeks selection links |
SelectWeekText |
The text displayed for the week selection link |
ShowDayHeader |
A Boolean value that specifies whether the days of the week
header should be shown |
ShowGridLines |
A Boolean value that specifies whether the grid lines
between days should be shown |
ShowNextPrevMonth |
A Boolean value that specifies whether the next and
previous month links should be shown |
ShowTitle |
A Boolean value that specifies whether the title of the
calendar should be shown |
TitleFormat |
The format for the title of the calendar. Can take one of
the following values:
|
TitleStyle |
The style of the title of the calendar |
TodayDayStyle |
The style for today's date |
TodaysDate |
Today's date |
VisibleDate |
The date that specifies the month that is currently visible
in the calendar |
WeekendDayStyle |
The style for weekends |
In the following example we declare a Calendar
control in its simplest use, in an .aspx file:
In the following example we declare a Calendar
control in an .aspx file. The days are displayed with full names, the
weekends are displayed in blue on a yellow background, and the current date is
displayed with a red background:
In the following example we declare a Calendar
control in an .aspx file. The days are displayed with full names, the user
may select a day, a week, or the whole month, and the selected day/week/month is
displayed with a grey background color:
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.