System.Web.UI.WebControls Namespace Calendar Class
Occurs when each day is created in the control hierarchy for the Calendar.
[ VB ]
Public Event DayRender As DayRenderEventHandler
[ C# ]
public event DayRenderEventHandler DayRender;
[ C++ ]
public: __event DayRenderEventHandler* DayRender;
In [ JScript ], you can handle the events defined by a class, but you cannot define your own.
The method assigned to handle the event is passed a DayRenderEventArgs object containing data related to the DayRender event. The following DayRenderEventArgs properties provide information specific to this event.
For more information about handling events, see Web Forms Events Model.
The following example demonstrates how to specify and code a handler for the DayRender event to change the background color of the days in the current month.
<html>
<head>
<script language = "C#" runat = "server">
void DayRender ( Object src, DayRenderEventArgs e ) {
if ( !e.Day.IsOtherMonth && !e.Day.IsWeekend )
e.Cell.BackColor=System.Drawing.Color.FromString ( "yellow" );
}
</script>
</head>
<body>
<h3>Calendar onDayRender Event Example</h3>
<form runat = "server">
<asp:Calendar id = "myCalendar" runat = "server"
WeekendDayStyle-BackColor = "gray"
onDayRender = "DayRender" />
</form>
</body>
</html>
Show me
Calendar Members