Export (0) Print
Expand All

DayRenderEventArgs Class

Provides data for the DayRender event of the Calendar control. This class cannot be inherited.

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

[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class DayRenderEventArgs sealed

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.

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.

No code example is currently available or this language may not be supported.

System::Object
  System.Web.UI.WebControls::DayRenderEventArgs

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft