Prop Webcontrol Calendar Caption
## ASP.NET Calendar Caption Property
The `Caption` property is a member of the ASP.NET Web Control `Calendar` class. It is used to set or return the text that is displayed as the title/caption of the Calendar control.
This property is highly useful for accessibility (such as screen readers) and for providing clear, semantic labeling for your calendar interface.
---
## Definition and Usage
The `Caption` property allows developers to specify a text string that acts as an accessible header for the rendered HTML table of the Calendar control. When rendered, this property generates an HTML `` element inside the table, which is the standard way to provide a title for a data table.
---
## Syntax
```xml
```
### Property Values
| Property Value | Description |
| :--- | :--- |
| `text` | A string value representing the text to be displayed as the calendar's caption. |
---
## Code Example
The following example demonstrates how to set the `Caption` property of an ASP.NET Calendar control in an `.aspx` page:
```xml
<%@ Page Language="C#" %>
ASP.NET Calendar Caption Example
```
---
## Key Considerations & Best Practices
1. **Accessibility (Section 508 / WCAG):** Using the `Caption` property is highly recommended for web accessibility. Screen readers read the `` element to help visually impaired users understand the purpose of the table (the calendar) before they navigate through its cells.
2. **Styling the Caption:** By default, the caption text inherits standard browser table caption styling (usually centered above the table). You can style this caption using CSS by targeting the `caption` selector or by using the `CaptionAlign` property to position it.
3. **Caption Alignment:** You can pair the `Caption` property with the `CaptionAlign` property to control where the text appears. The available options for `CaptionAlign` are:
* `NotSet` (Default)
* `Top`
* `Bottom`
* `Left`
* `Right`
YouTip