YouTip LogoYouTip

Prop Webcontrol Calendar Weekenddaystyle

## ASP.NET Calendar WeekendDayStyle Property The `WeekendDayStyle` property is used to get or set the style of weekend days (Saturdays and Sundays) in an ASP.NET `Calendar` control. By default, weekend days are rendered with the same style as regular weekdays. Using this property, you can visually distinguish weekends from weekdays by changing their background color, font style, border, and more. --- ## Syntax and Usage You can define the `WeekendDayStyle` property in two ways: 1. **Inner Tag Syntax:** Using a nested `` element inside the `` control. 2. **Attribute Prefix Syntax:** Using the `WeekendDayStyle-` prefix directly on the `` tag. ### Inner Tag Syntax ```xml ``` ### Attribute Prefix Syntax ```xml ``` ### Property Values | Property | Description | | :--- | :--- | | `style` | Specifies the style property you want to apply (e.g., `BackColor`, `ForeColor`, `Font-Bold`, `BorderColor`). For a complete list of applicable style properties, refer to the standard (https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.style). | | `value` | The value assigned to the specified style property (e.g., `#FF0000` for red text, `True` for bold font). | --- ## Code Examples ### Example 1: Using the Inner Tag Syntax This example demonstrates how to set the text color of weekend days to red using the nested `` tag. ```xml
``` ### Example 2: Using the Attribute Prefix Syntax This example achieves the exact same visual result as Example 1, but uses the inline attribute prefix syntax. ```xml
``` ### Example 3: Advanced Styling (Declarative and Programmatic) You can combine multiple style properties to make weekends stand out. The following example sets a light gray background, bold red text, and a custom border for weekend days. ```xml
``` --- ## Technical Considerations * **Precedence:** If you define styles at the calendar level (such as `DayStyle`), the more specific `WeekendDayStyle` will override those general styles for Saturdays and Sundays. * **Overlapping Styles:** If you also use `SelectedDayStyle` or `TodayDayStyle`, those styles will take precedence over `WeekendDayStyle` when a weekend day is selected or happens to be the current date. * **Browser Rendering:** ASP.NET renders these styles as inline CSS styles inside HTML `` elements. Ensure your global CSS stylesheets do not unintentionally override these inline styles with `!important` declarations.
← Prop Webcontrol Calendarday DaProp Webcontrol Calendar Visib β†’