Latest web development tutorials

ASP.NET Calendar Control

Web Server Controls Web server control

Definition and Usage

Calendar control is used to display the calendar in your browser.

The control displays a month calendar that allows users to select a date, you can skip to the previous or next month.


Attributes

属性 描述 .NET
Caption 日历的标题。 2.0
CaptionAlign 日历标题文本的对齐方式。 2.0
CellPadding 单元格边框与内容之间的空白,以像素计。 1.0
CellSpacing 单元格之间的空白,以像素计。 1.0
DayHeaderStyle 显示一周中各天的名称的样式。 1.0
DayNameFormat 显示一周中各天的名称的格式。 1.0
DayStyle 显示日期的样式。 1.0
FirstDayOfWeek 哪天是周的第一天。 1.0
NextMonthText 显示下一月链接的文本。 1.0
NextPrevFormat 下一月和上一月链接的格式。 1.0
NextPrevStyle 显示下一月和上一月链接的样式。 1.0
OtherMonthDayStyle 显示不在当前月中的日期的样式。 1.0
PrevMonthText 显示上一月链接的文本。 1.0
runat 规定该控件是服务器控件。必须设置为 "server"。 1.0
SelectedDate 选定的日期。 1.0
SelectedDates 选定的日期。 1.0
SelectedDayStyle 选定日期的样式。 1.0
SelectionMode 允许用户如何选择日期。 1.0
SelectMonthText 显示为月份选择链接的文本。 1.0
SelectorStyle 月份和周的选择链接的样式。 1.0
SelectWeekText 显示为周的选择链接的文本。 1.0
ShowDayHeader 布尔值,该值指示是否显示一周中各天的标头。 1.0
ShowGridLines 布尔值,规定是否显示日期之间的网格线。 1.0
ShowNextPrevMonth 布尔值,规定是否显示下一月和上一月链接。 1.0
ShowTitle 布尔值,规定是否现实日期的标题。 1.0
TitleFormat 日期标题的格式。 1.0
TitleStyle 日期标题的样式。 1.0
TodayDayStyle 当天的日期的样式。 1.0
TodaysDate 获取或设置今天的日期的值。 1.0
UseAccessibleHeader 规定是否使用 <th> 来代替 <td> 元素用于日的头部。 2.0
VisibleDate 获取或设置指定要在 Calendar 控件上显示的月份的日期。 1.0
WeekendDayStyle 周末的样式。 1.0
OnDayRender 当每一天的单元格被创建时,所执行的函数的名称。
OnSelectionChanged 当用户选择天、周或月时 ,所执行的函数的名称。
OnVisibleMonthChanged 当用户导航到不同的月时,所执行的函数的名称。

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, visit the Web Control Standard Attributes .

Control Standard Properties

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

For a full description, go to Control Standard Attributes .


Examples

Try - Example

Calendar
In this case, we have declared in the .aspx file that uses the most simple Calendar control.

Calendar 2
In this example, we declare a Calendar control in an .aspx file. Dates to display the full name of the blue, weekend yellow background 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 to display the full name, the user can select the day, week or the entire month, the selected day / week / month gray background color to display.


Web Server Controls Web server control