YouTip LogoYouTip

Prop Webcontrol Calendar Othermonthdaystyle

## ASP.NET Calendar OtherMonthDayStyle Property The `OtherMonthDayStyle` property is used to get or set the style for days on the `Calendar` control that do not belong to the currently displayed month. For example, if the calendar is currently displaying the month of October, the days from late September and early November that appear on the grid to fill out the weeks will be styled using the properties defined in `OtherMonthDayStyle`. --- ## Syntax and Usage You can define the `OtherMonthDayStyle` property in two ways: 1. **Inner Property Tag:** Declaring an `` element inside the `` control. 2. **Inline Attribute Prefix:** Using the `OtherMonthDayStyle-` prefix directly within the `` tag. ### Declarative Syntax ```xml ``` ### Property Values | Attribute | Description | | :--- | :--- | | `style` | The style property you want to set (e.g., `ForeColor`, `BackColor`, `Font-Bold`, `CssClass`). For a complete list of applicable style properties, refer to the standard (control-style.html) properties. | | `value` | The value to assign to the specified style property (e.g., `#FF0000`, `true`, `MyCustomClass`). | --- ## Code Examples ### Example 1: Using the Inner Property Tag This example demonstrates how to set the text color of the days from other months to red using the inner `` tag. ```xml
``` ### Example 2: Using the Inline Attribute Prefix This example achieves the exact same visual result as Example 1, but uses the inline `OtherMonthDayStyle-ForeColor` attribute. ```xml
``` --- ## Key Considerations * **Visual Hierarchy:** It is a best practice to style other-month days with a muted color (such as light gray) so that users can easily distinguish them from the days of the currently selected month. * **Interaction:** Even though these days belong to a different month, they are still fully clickable. Clicking an other-month day will trigger the `SelectionChanged` event and automatically navigate the calendar to that day's month. * **Overriding Styles:** If you apply a global style to all days using `DayStyle`, the properties specified in `OtherMonthDayStyle` will override those settings for the days belonging to adjacent months.
← Prop Webcontrol Calendar PrevmProp Webcontrol Calendar Nextp β†’