System.Web.UI.WebControls.DayRenderEventArgs Class

Provides data for the Calendar.DayRender event of the System.Web.UI.WebControls.Calendar control. This class cannot be inherited.

See Also: DayRenderEventArgs Members


public sealed class DayRenderEventArgs


Although data binding is not supported for the System.Web.UI.WebControls.Calendar control, it is possible to modify the content and formatting of the individual date cells. Before the System.Web.UI.WebControls.Calendar control is displayed on the Web page, it creates and assembles the components that make up the control. The Calendar.DayRender event is raised when each date cell in the System.Web.UI.WebControls.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 Calendar.DayRender event.

The event handler receives a System.Web.UI.WebControls.DayRenderEventArgs object that contains event data. Use the DayRenderEventArgs.Cell property to access the cell being rendered. To access the properties of the day being rendered, use the DayRenderEventArgs.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 DayRenderEventArgs.SelectUrl property.

For a list of initial property values for an instance of System.Web.UI.WebControls.DayRenderEventArgs, see the DayRenderEventArgs.#ctor(TableCell, CalendarDay) constructor.

For more information about handling events, see Consuming Events.


Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0,