asp.net.ph

Calendar.DayRender Event

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.

Event Data

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.

Property Description
Cell Gets the TableCell that displays the day specified by Day.
Day Gets the CalendarDay that represents the day to render.

Remarks

For more information about handling events, see Web Forms Events Model.

Example

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 

See Also

Calendar Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph