Calendar::DayRender Event
Occurs when each day is created in the control hierarchy for the Calendar control.
Assembly: System.Web (in System.Web.dll)
This event is raised when each day is created in the control hierarchy for the Calendar control.
Although data binding is not supported for the Calendar control, it is possible to modify the content and formatting of the individual date cells. Before the Calendar control is displayed on the Web page, it creates and assembles the components that make up the control. The DayRender event is raised when each date cell in the Calendar control is created. You can control the contents and formatting of a date cell when it is created by providing code in the event handler for the DayRender event. For more information on customizing the contents of a date cell, see OnDayRender.
Note |
|---|
Because the DayRender event is raised while the Calendar control is being rendered, you cannot add a control that can also raise an event, such as LinkButton. You can only add static controls, such as System.Web.UI::LiteralControl, Label, Image, and HyperLink. |
For more information about handling events, see Events and Delegates.
| Topic | Location |
|---|---|
| How to: Customize Individual Days in a Calendar Web Server Control | Building ASP .NET Web Applications |
| How to: Display Selected Dates from a Database in the Calendar Control | Building ASP .NET Web Applications |
| How to: Customize Individual Days in a Calendar Web Server Control | Building ASP .NET Web Applications |
| How to: Display Selected Dates from a Database in the Calendar Control | Building ASP .NET Web Applications |
The following code example demonstrates how to specify and code a handler for the DayRender event to make the background color yellow for the days in the displayed month. It also demonstrates how to customize the contents of a cell by adding a System.Web.UI::LiteralControl control to the cell.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note