DayRenderEventArgs Class
Assembly: System.Web (in System.Web.dll)
The DayRenderEventArgs type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | DayRenderEventArgs(TableCell, CalendarDay) | Initializes a new instance of the DayRenderEventArgs class using the specified cell and calendar day. |
![]() | DayRenderEventArgs(TableCell, CalendarDay, String) | Initializes a new instance of the DayRenderEventArgs class using the specified cell, calendar day, and selection URL. |
| Name | Description | |
|---|---|---|
![]() | Cell | Gets the TableCell object that represents the cell being rendered in the Calendar control. |
![]() | Day | Gets the CalendarDay object that represents the day being rendered in the Calendar control. |
![]() | SelectUrl | Gets the script used to post the page back to the server when the date being rendered is selected in a Calendar control. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
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.
The event handler receives a DayRenderEventArgs object that contains event data. Use the Cell property to access the cell being rendered. To access the properties of the day being rendered, use the Day property. When customizing the content for a cell, you might want to preserve the postback behavior when the user selects the date being rendered. This is typically done by rendering the script used to post the page as part of the custom content. To retrieve the script used to post the page back to the server, use the SelectUrl property.
For a list of initial property values for an instance of DayRenderEventArgs, see the DayRenderEventArgs constructor.
For more information about handling events, see Consuming Events.
| Topic | Location |
|---|---|
| How to: Customize Individual Days in a Calendar Web Server Control | Building ASP .NET Web Applications |
| How to: Customize Individual Days in a Calendar Web Server 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.


