|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Delegado DayRenderEventHandler
Assembly: System.Web (em System.Web.dll)
Parâmetros
- sender
- Tipo: System.Object
fonte do evento.
- e
- Tipo: System.Web.UI.WebControls.DayRenderEventArgs
A DayRenderEventArgs que contém os dados do evento.
<%@ Page Language="C#" AutoEventWireup="True" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>DayRender Event Example</title> <script language="C#" runat="server"> void DayRender(Object source, DayRenderEventArgs e) { // Change the background color of the days in the month// to yellow.if (!e.Day.IsOtherMonth && !e.Day.IsWeekend) e.Cell.BackColor=System.Drawing.Color.Yellow; // Add custom text to cell in the Calendar control.if (e.Day.Date.Day == 18) e.Cell.Controls.Add(new LiteralControl("<br />Holiday")); } </script> </head> <body> <form id="form1" runat="server"> <h3>DayRender Event Example</h3> <asp:Calendar id="calendar1" OnDayRender="DayRender" runat="server"> <WeekendDayStyle BackColor="gray"> </WeekendDayStyle> </asp:Calendar> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Calendar DayRender Example</title> <script runat="server"> void DayRender(Object sender, DayRenderEventArgs e) { // Change the background color of the days in the month// to yellow.if (!e.Day.IsOtherMonth && !e.Day.IsWeekend) { e.Cell.BackColor=System.Drawing.Color.Yellow; } // Add custom text to cell in the Calendar control.if (e.Day.Date.Day == 18) { e.Cell.Controls.Add(new LiteralControl("<br />Holiday")); } } void Page_Load(Object sender, EventArgs e) { // Manually register the event-handling method for the DayRender // event of the Calendar control. Calendar1.DayRender += new DayRenderEventHandler(this.DayRender); } </script> </head> <body> <form id="form1" runat="server"> <h3>Calendar DayRender Example</h3> <asp:Calendar id="Calendar1" runat="server"> <WeekendDayStyle BackColor="gray"> </WeekendDayStyle> </asp:Calendar> </form> </body> </html>
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
o.NET Framework e.NET Compact Framework não oferecem suporte a todas as versões de cada plataforma. Para obter uma lista de versões suportadas, consulte Requisitos de sistema do .NET framework.