Because the Calendar Web control is a complex control made up out of many individual elements, it offers you a wide variety of options for customizing its appearance. In this topic, you can learn about the following customization options:
You can change the overall appearance of the Calendar control, which establishes a default look for the calendar on the page. If you set appearance properties for individual calendar elements, such as today's date, the selected date, and so on, the individual settings are based on the default settings you make for the calendar as a whole. You can also select from predefined Calendar formats.
Note By default, there is no special formatting to indicate today's date on the Calendar control. For details about how to set this format, see Formatting Calendar Elements Using Styles.
To change the general appearance of the Calendar control
To affect | Set this property |
---|---|
Font, text and background color | Font, ForeColor, BackColor |
Overall control size | Height, Width |
Margins and spacing around individual days | CellPadding, CellSpacing |
Color, size, and style (eg, dotted) of border and grid lines |
|
By default, the names of the days of the week are displayed in a row at the top of the calendar. You can control the format of this row.
To change the day of week display
To | Set this property |
---|---|
Enable or disable the row with days of the week | ShowDayHeader (true or false) |
Specify the format of day names (for example, full day name or abbreviation) | DayNameFormat (use a value in the DayNameFormat enumeration: Full, Short, FirstLetter, FirstTwoLetters). |
Specify which day starts the week (default is Sunday) | FirstDayOfWeek (use a day defined in the FirstDayOfWeek enumeration). If you don't explicitly set this property, the first day of the week is Sunday. [Or is it locale specific?]. |
Set color, font, border style and width, and so on | DayHeaderStyle, which incorporates style information. For details, see Formatting Calendar Elements Using Styles. |
The title bar by default displays the name of the current month and a set of navigation links (LinkButton Web controls) that allow users to move to the next and previous months.
To change month display and navigation links
To | Set this property |
---|---|
Remove the title bar altogether (which disables month navigation). | ShowTitle (true or false) |
Specify the format of the name of the month (for example, full name or abbreviation) and optionally add a year. |
|
Specify the format and text of month navigation links |
|
Set color, font, border style and width, and so on | TitleStyle, which incorporates style information. For details, see Formatting Calendar Elements Using Styles.
Note You can format the navigation links separately using the NextPrevStyle property. |
See Also
Formatting Calendar Elements Using Styles | Controlling User Date Selection