The Calendar control provides functionality to display a single month of a calendar on a Web page. The control allows end users to select dates and move to the next or previous month. This control supports all the System.Globalization.Calendar types in System.Globalization namespace. For example Web developers can include in their applications Gregorian calendar or calendars that use different year and month systems.

Web developers can determine if the Calendar control allows end users to select a single day, week, or entire month by setting the SelectionMode property.By default, the control displays the days of the month, day headings for the days of the week, a title with the month name and year, links for selecting individual days of the month, and links for moving to the next and previous month. Web developers can customize the appearance of the control by setting the properties that control the style for different parts of the control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)

Property Description Supported in .NET version
AccessKey This property returns or sets the access key that allows software developer to quickly navigate to the Web server control. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Adapter This property gets the browser-specific adapter for the control. 2.0, 3.0, 3.5, 4.0
AppRelativeTemplateSourceDirectory

 

Software developer can use this property to set or get the application-relative path to the page or user control that contains the current control.  If the web page is installed in https://www.somesite.com/apps/application1 the property will return “~/application1”. 2.0, 3.0, 3.5, 4.0
Attributes This property is a collection which contains a collection of all attributes declared in the opening tag of a Web server control. Software developer can control programmatically the attributes associated with a Web server control. He/she can add or remove attributes to/from the collection. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
BackColor The property is used to specify the background color of the Web server control. Software developer can set it using a System.Drawing..::.Color object. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
BindingContainer Software developer can’t use this property directly from his/her code, because it supports the .NET Framework infrastructure.  The property contains a reference to the Control object which contains data-binding information for the current control. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
BorderColor The property is used to specify the border color of the Web server control. Software developer can set it using a System.Drawing..::.Color object. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
BorderStyle Specifies the type of the control’s border. Software developer can choose one of the values from the BorderStyle enumeration – Dashed, Dotted, Double, Grrove, Ridge, Inset, Outset, Solid and None. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
BorderWidth Specifies the size of the control’s border.  When software developer sets this property he/she should use combination of a numeric value followed by type of measurement: px (for pixels) or % (for percentage) and so on. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Caption A table caption is used to describe the nature of the table in one to three sentences. This property is used to get or set a text value that is rendered as a caption for the calendar. 2.0, 3.0, 3.5, 4.0
CaptionAlign This property is used to get or set the alignment of the text that is rendered as a caption for the calendar. The default property value is NotSet, which lets the browser to determine where to align the caption. Other possible values are:

–          Bottom – the caption appears at the bottom of the calendar, with the text centered

–          Left – the caption appears at the top of the calendar, with the text left-aligned.

–          Right – the caption appears at the top of the calendar, with the text right-aligned.

–          Top – the caption appears at the top of the calendar with the text centered.

2.0, 3.0, 3.5, 4.0
CellPadding Web developers can use this property to get or set the amount of space between the contents of a cell and the cell’s border.

Note: Setting this property to -1 indicates that this property is not set in the rendered table.

1.0,1.1, 2.0, 3.0, 3.5, 4.0
CellSpacing This property is used to get or set the amount of space between cells.

Note: Setting this property to -1 indicates that this property is not set in the rendered table.

1.0,1.1, 2.0, 3.0, 3.5, 4.0
ChildControlsCreated Gets a true value that indicates whether the server control’s child controls have been created. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
ClientID Returns the server control identifier generated by ASP.NET. The ClientID value is generated by concatenating the ID value of the control and the UniqueID value of its parent control. If the ID value of the control is not specified, an automatically generated value is used. Each part of the generated ID is separated by an underscore character (_). 1.0,1.1, 2.0, 3.0, 3.5, 4.0
ClientIDSeparator The ClientID value is generated by concatenating the ID value of the control and the UniqueID value of its parent control. Each part of the generated ID property is separated by the ClientIDSeparator property value. The value always returns an underscore (_). 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Context Software developer can use this property to access the HttpContext object for the current Web request. Using properties of the object software developer can access objects Application, Session, Request, Response, etc. which contain information about the current HTTP request. The object provides methods that allow him to get configuration information and to set or clear errors related to the request. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Controls This property allows software developer to access programmatically to the instance of the ControlCollection class for any server control. Using it he/she can add/remove controls to/from the collection or iterate through the server controls in the collection. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
ControlStyle This property is used to encapsulate all properties of the WebControl class that specify the appearance of the control, such as BorderColor and Font. This property is used primarily by control developers. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
ControlStyleCreated This property is used primarily by control developers. Returns a true value if a Style object has been created for the ControlStyle property; otherwise false. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
CssClass Software developer can use this property to specify the CSS class to render on the client for the Web Server control. This property will render on browsers for all controls. On browsers that do not support CSS, setting the CssClass property will have no effect. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
DayHeaderStyle Returns the style properties for the section that displays the day of the week. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
DayNameFormat With this property Web developers can get or set the name format for days of the week. They can specify whether the days of the week are displayed as the full name, short (abbreviated) name, first letter of the day, or first two letters of the day.

Note: This property applies only if the ShowDayHeader property is set to true.

1.0,1.1, 2.0, 3.0, 3.5, 4.0
DayStyle Returns the style properties for the days in the displayed month. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
DesignMode This property returns true to indicate that the control is being used in the context of a designer. Software developer’s custom controls can use this property when design-time behavior is different than run-time behavior. 2.0, 3.0, 3.5, 4.0
Enabled Software developer should set this property to true when he/she wants to specify or determine whether a control is functional. When developer sets to false, the control appears dimmed, preventing any input from being entered in the control. Notes:

  • Not all browsers support this property. Dimming and locking the control only works in browsers that are compatible with Microsoft Internet Explorer version 4 and later.
  • In a custom composite control, this behavior does not apply to controls that have not yet created their child controls.
  • A disabled control can support postbacks. It is possible for a user who is viewing the page with a disabled control to craft a request that submits a postback that is processed by the page.
1.0,1.1, 2.0, 3.0, 3.5, 4.0
EnableTheming This property overrides Control. EnableTheming.

The property indicates whether themes are enabled for a specified control. When the property’s value is true, the application’s theme directory is searched for control skins to apply. If for the particular control skin does not exist in the directory, skins are not applied. When the property’s value is false, the theme directory is not searched and the contents of the SkinID property are not used.

2.0, 3.0, 3.5, 4.0
EnableViewState Software developer must enable view state for the server control setting its value to true if he/she wants to maintain its state across HTTP requests. Sometimes is better to set value of this property to false if for example Web application is loading a database request into a server control. In this case application performance will be improved. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Events This read-only property returns a list of event handler delegates for the control. The type of this property is EventHadlerList, which uses a linear search algorithm to find entries in the list of delegates. When the list of delegates is large, finding entries with this property will be slow, because a linear search algorithm is inefficient when working with a large number of entries. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
FirstDayOfWeek With this property Web developers can get or set the day of the week to display in the first day column of the Calendar control. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Font Software developer can use this property to specify the font properties of the Web Server control. This property includes subproperties that can be accessed declaratively in the form of Property-Subproperty (for example Font-Bold) or programmatically in the form of Property.Subproperty (for example Font.Bold).

All but one subproperty will render in browsers prior to Microsoft Internet Explorer version 4 for all controls. They are: Bold, Italic, Name, Names, Strikeout, Underline, and Size (but only named font sizes, such as Small, Smaller, and so on, will work).

 

1.0,1.1, 2.0, 3.0, 3.5, 4.0
ForeColor Software developer can use this property to to specify the foreground color of the Web server control. The foreground color is usually the color of the text. This property will render on browsers earlier than Microsoft Internet Explorer version 4 for all controls, except the Image, AdRotator, HyperLink and LinkButton. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
HasAttributes This property returns true when the WebControl instance has attribute name/value pairs. The attribute pairs can be set either in the property or in the view state. 2.0, 3.0, 3.5, 4.0
HasChildViewState Software developer can use this property to verify that any child controls of the server control are storing view-state information. Using it in this way he/she can avoid unnecessary calls to the ClearChildViewState method. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Height This property is used to specify the height of the Web server control. When software developer sets this property he/she should use combination of a numeric value followed by type of measurement: px (for pixels) or % (for percentage) and so on.This property does not render for all controls in browsers earlier than Microsoft Internet Explorer version 4. Controls that do not render this property in earlier browsers include Label, HyperLink, LinkButton, and any validation controls. The CheckBoxList, RadioButtonList and DataList also do not render this property in earlier browsers when their RepeatLayout property is set to RepeatLayout.Flow. Furthermore, only unit types of Pixel and Percentage are supported in earlier browsers. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
ID Web developers can set this property by declaring ID attribute in the opening tag of an ASP.NET server control. Another possible way to set it is programmatically. If this property is not specified for a server control, either declaratively or programmatically, Web developer can obtain a reference to the control through its parent control’s Controls property. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
IdSeparator Software developer can’t use this property directly from his/her code, because it supports the .NET Framework infrastructure.   The character contained in this property ( by default $ ) is used to separate the control identifiers for child controls. The ID separator character is appended to the ID property. 2.0, 3.0, 3.5, 4.0
IsChildControlStateCleared This property has value true if children of this control do not use control state; otherwise, false. 2.0, 3.0, 3.5, 4.0
IsEnabled This property returns true if the Enabled property is true for this control and any containing controls. 2.0, 3.0, 3.5, 4.0
IsTrackingViewState This property returns value true if the control is marked to save changes to its view state; otherwise, false.

 

1.0,1.1, 2.0, 3.0, 3.5, 4.0
IsViewStateEnabled This property returns value true if view state is enabled for the control; otherwise false.  View state can be enabled at the page, container, or control level. When view state is disabled at the page or container level, view state is disabled for all controls contained by the page or container. The property indicates whether view state is enabled by pages, containers, or controls. In some cases it is possible values for the EnableViewState property and the IsViewStateEnabled property to be different. For example, if the Page containing the control has view state disabled, the EnableViewState property can be true while the IsViewStateEnabled property is false. Notes: Developers will set the EnableViewState property to indicate whether they are using view state with your control. Web developers can use this property in their code to determine whether view state is enabled for their control and all containers. 2.0, 3.0, 3.5, 4.0
LoadViewStateByID This property returns value true if the control loads its view state by ID; otherwise, false. Its default value is false. 2.0, 3.0, 3.5, 4.0
NamingContainer Using this property software developer can get a reference to the server control’s naming container, which creates a unique namespace for differentiating between server controls with the same Control.ID property value. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
NextMonthText The property is used to get or set the text displayed for the next month navigation control. The default value is “>”, which is rendered as the greater than sign (>).  This property applies only if the ShowNextPrevMonth property is set to true.

Note: This property does not automatically encode to HTML. Web developers need to convert special characters to the appropriate HTML value, unless they want the characters to be treated as HTML.  If they want to display an image for the next month navigation control, they can set this property to an expression that contains an <img> element.

1.0,1.1, 2.0, 3.0, 3.5, 4.0
NextPrevFormat This property is used to get or set the format of the next and previous month navigation elements in the title section of the Calendar control. This property applies only if the ShowNextPrevMonth property is set to true. Web developers can specify custom navigation text, setting this property to NextPrevFormat.CustomText and setting the NextMonthText and PrevMonthText properties to the custom text. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
NextPrevStyle Returns the style properties for the next and previous month navigation elements. This property applies only if the ShowNextPrevMonth property is set to true. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
OtherMonthDayStyle Returns the style properties for the days on the Calendar control that are not in the displayed month. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Page Provides a reference to the web page that contains this control as a System.Web.UI.Page object.  This property’s value reflects the name of the .aspx file that contains the server control. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Parent This property provides a reference to the control that contains this control. If the control is placed on the page directly (rather than inside another control), it will return a reference to the page object. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
PrevMonthText The property is used to get or set the text displayed for the previous month navigation control. This property applies only if the ShowNextPrevMonth property is set to true. The default value is “&lt;”, which is rendered as the less than sign (<).

Note: This property does not automatically encode to HTML. Web developers need to convert special characters to the appropriate HTML value, unless they want the characters to be treated as HTML.  If they want to display an image for the next month navigation control, you can set this property to an expression that contains an <img> element.

1.0,1.1, 2.0, 3.0, 3.5, 4.0
SelectedDate With this property Web developers can get or set the selected date. The property is set using a System.DateTime object.

The SelectedDate property and the SelectedDates collection are closely related. When the SelectionMode property is set to CalendarSelectionMode.Day, a mode that allows only a single date selection, SelectedDate and SelectedDates[0] have the same value and SelectedDates.Count equals 1. When the SelectionMode property is set to CalendarSelectionMode.DayWeek or CalendarSelectionMode.DayWeekMonth, modes that allows multiple date selections, SelectedDate and SelectedDates[0] have the same value.

Note: Both the SelectedDate property and the SelectedDates collection are updated before the SelectionChanged event is raised. Web developers can override the date selection by using the OnSelectionChanged event handler to manually set the SelectedDate property. The SelectionChanged event does not get raised when this property is programmatically set.

1.0,1.1, 2.0, 3.0, 3.5, 4.0
SelectedDates Returns a collection of System.DateTime objects that represent the selected dates on the Calendar control.

Note: For more details read description of SelectedDate property

1.0,1.1, 2.0, 3.0, 3.5, 4.0
SelectedDayStyle Returns the style properties for the selected dates. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
SelectionMode This property is used to get or set the date selection mode on the Calendar control that specifies whether the user can select a single day, a week, or an entire month. When this property is set to CalendarSelectionMode.DayWeek or CalendarSelectionMode.DayWeekMonth, an additional selector column that contains week and month selection controls is displayed in the first column of the Calendar control. Web developers should use the SelectorStyle property to customize the appearance of this column. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
SelectMonthText Returns or sets the text displayed for the month selection element in the selector column. This property applies only if the SelectionMode property is set to CalendarSelectionMode.DayWeekMonth. The property default value is “&gt;&gt;”, which is rendered as two greater than signs (>>).

Note: This property does not automatically encode to HTML. Web developers need to convert special characters to the appropriate HTML value, unless they want the characters to be treated as HTML. If they want to display an image for the next month navigation control, you can set this property to an expression that contains an <img> element.

1.0,1.1, 2.0, 3.0, 3.5, 4.0
SelectorStyle Returns the style properties for the week and month selector column. The SelectorStyle property applies only when the SelectionMode property is set to CalendarSelectionMode.DayWeek or CalendarSelectionMode.DayWeekMonth. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
SelectWeekText The property can be used to get or set the text displayed for the week selection element in the selector column. The default value is “&gt;”, which is rendered as a greater than sign (>).This property applies only if the SelectionMode property is set to CalendarSelectionMode.DayWeek or CalendarSelectionMode.DayWeekMonth.

Note: This property does not automatically encode to HTML. Web developers need to convert special characters to the appropriate HTML value, unless they want the characters to be treated as HTML. If they want to display an image for the next month navigation control, you can set this property to an expression that contains an <img> element.

1.0,1.1, 2.0, 3.0, 3.5, 4.0
ShowDayHeader This property gets or sets a value indicating whether the heading for the days of the week is displayed. Its default value is false. If Web developers want to display the heading for the days of the week they should set property value to true. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
ShowGridLines The property is used to get or set a value indicating whether the days on the Calendar control are separated with gridlines. Its default value is false. Web developers can activate this functionality setting property value to true. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
ShowNextPrevMonth This property is used to get or set a value indicating whether the Calendar control displays the next and previous month navigation elements in the title section. Its default value is false. The Calendar displays the next and previous month navigation elements in the title section if property value is set to true. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
ShowTitle The property is used to get or set a value indicating whether the title section is displayed. Its default value is true. The title is displayed if this property is set to true. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Site Using this property software developer can get information about the container that hosts the current control when rendered on a design surface.  A site binds a Component object to a Container object and enables communication between the two. It also provides a way for the container to manage its components. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
SkinID This property overrides Control.SkinID.

Web developer can get or set the skin to apply to the control.  Skins available to a control are contained in one or more skin files in a theme directory. The SkinID property specifies which of these skins to apply to the control. A skin is specific to a particular control i.e. software developer cannot share skin setting between controls of different types. If developer does not set the SkinID property, a control uses the default skin if one is defined.

2.0, 3.0, 3.5, 4.0
Style Web developer can use this property to get a collection of text attributes that will be rendered as a style attribute on the outer tag of the Web server control. This property will render on all browsers for all controls. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
TabIndex With this number software developer can control the tab order. The control with a TabIndex of  zero has the focus when the page first loads. If end user presses Tab his/her focus will be moved to the control with the next lowest TabIndex. This property is available only in Internet Explorer 4.0 and higher. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
TagKey Web developers can use this property to get the HtmlTextWriterTag value that corresponds to this Web server control. This property is used primarily by control developers. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
TagName Web developers can use this property to get the name of the control tag. This property is used primarily by control developers. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
TemplateControl This property is used to get or set a reference to the template that contains this control. 2.0, 3.0, 3.5, 4.0
TemplateSourceDirectory Software developer can use this property to get the path to the page or user control that contains the current control.  If the web page is installed in https://www.somesite.com/apps/application1 the property will return “apps/application1”. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
TitleFormat This property gets or sets the format for the title section. Its default value is MonthYear. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
TitleStyle Returns the style properties of the title heading for the Calendar control. The TitleStyle property applies only when the ShowTitle property is set to true. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
TodayDayStyle Gets the style properties for today’s date on the Calendar control.  If the TodayDayStyle property is not set, the style specified in the DayStyle property is used. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
TodaysDate The property is used to get or set the value for today’s date. This property is set using a System.DateTime object.

Note: If the VisibleDate property is not set, the date specified by the TodaysDate property determines which month is displayed in the Calendar control.

1.0,1.1, 2.0, 3.0, 3.5, 4.0
ToolTip This property displays a text message when the end users hover the mouse above the control. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
UniqueID This property can be used to get the unique, hierarchically qualified identifier for the server control. This property differs from the ID property, in that the UniqueID property includes the identifier for the server control’s naming container. This identifier is generated automatically when a page request is processed. This property is particularly important in differentiating server controls contained within a data-binding server control that repeats as Repeater, DataList, DetailsView, FormView, and GridView Web server controls. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
UseAccessibleHeader The property is used to get or set a value that indicates whether to render the table header <th> HTML element for the day headers instead of the table data <td> HTML element. 2.0, 3.0, 3.5, 4.0
ViewState Web developers can use this property to get a dictionary of state information that allows them to save and restore the view state of a server control across multiple requests for the same page. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
ViewStateIgnoresCase This property returns true if StateBag object is insensitive; otherwise, false. Its default value is false. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Visible Web developers can use this property to get or set a value that indicates whether a server control is rendered as UI on the page. If the control is visible on the page this property will has value true; otherwise false. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
VisibleDate Returns or sets the date that specifies the month to display on the Calendar control. This property is set using a System.DateTime object. The VisibleDate property is updated before the VisibleMonthChanged event is raised. Web developers can provide a custom OnVisibleMonthChanged event handler to set the VisibleDate property and override the automatically generated value. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
WeekendDayStyle Return the style properties for the weekend dates on the Calendar control. If the WeekendDayStyle property is not set, the style specified in the DayStyle property is used. 1.0,1.1, 2.0, 3.0, 3.5, 4.0
Width This property is used to specify the width of the Web server control. When software developer sets this property he/she should use combination of a numeric value followed by type of measurement: px (for pixels) or % (for percentage) and so on.This property does not render for all controls in browsers earlier than Microsoft Internet Explorer version 4. Controls that do not render this property in earlier browsers include Label, HyperLink, LinkButton, and any validation controls. The CheckBoxList, RadioButtonList and DataList also do not render this property in earlier browsers when their RepeatLayout property is set to RepeatLayout.Flow. Furthermore, only unit types of Pixel and Percentage are supported in earlier browsers. 1.0,1.1, 2.0, 3.0, 3.5, 4.0