DayRenderEventArgs 클래스

정의

DayRender 컨트롤의 Calendar 이벤트에 대한 데이터를 제공합니다. 이 클래스는 상속될 수 없습니다.

public ref class DayRenderEventArgs sealed
public sealed class DayRenderEventArgs
type DayRenderEventArgs = class
Public NotInheritable Class DayRenderEventArgs
상속
DayRenderEventArgs

예제

다음 코드 예제에는 지정 하 고에 대 한 처리기를 코딩 하는 방법을 보여 줍니다.는 DayRender 이벤트의 배경색을 노란색 표시 된 달의 일 수 있도록 합니다. 셀의 내용을 추가 하 여 사용자 지정 하는 방법을 보여 줍니다는 System.Web.UI.LiteralControl 셀에는 컨트롤입니다.

<%@ 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="VB" 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="VB" runat="server">
   
        Sub DayRender(source As Object, e As DayRenderEventArgs)
            
            ' Change the background color of the days in the month
            ' to yellow.
            If Not e.Day.IsOtherMonth And Not e.Day.IsWeekend Then
                e.Cell.BackColor = System.Drawing.Color.Yellow
            End If 
            ' Add custom text to cell in the Calendar control.
            If e.Day.Date.Day = 18 Then
                e.Cell.Controls.Add(New LiteralControl(ChrW(60) & "br" & ChrW(62) & "Holiday"))
            End If 
        End Sub 'DayRender 

   </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>

설명

에 대 한 데이터 바인딩이 지원 되지 않습니다 하지만 Calendar 컨트롤 이며 콘텐츠를 수정할 수는 개별 날짜 셀 서식 지정 합니다. 컨트롤이 Calendar 웹 페이지에 표시되기 전에 컨트롤을 구성하는 구성 요소를 만들고 어셈블합니다. DayRender 이벤트는 각 날짜의 셀을 Calendar 컨트롤이 만들어집니다. 내용 및 코드에 대 한 이벤트 처리기에서 제공 하 여 만들어질 때 날짜 셀의 서식을 제어할 수 있습니다.는 DayRender 이벤트입니다.

이벤트 처리기는 이벤트 데이터가 포함된 개체를 받 DayRenderEventArgs 습니다. 사용 된 Cell 렌더링 되는 셀에 액세스 하는 속성입니다. 렌더링되는 날짜의 속성에 액세스하려면 속성을 사용합니다 Day . 셀의 콘텐츠를 사용자 지정할 때 사용자가 렌더링되는 날짜를 선택할 때 포스트백 동작을 유지할 수 있습니다. 이 작업은 일반적으로 페이지를 게시하는 데 사용되는 스크립트를 사용자 지정 콘텐츠의 일부로 렌더링하여 수행됩니다. 서버에 페이지를 다시 게시하는 데 사용되는 스크립트를 검색하려면 속성을 사용합니다 SelectUrl .

인스턴스의 초기 속성 값의 목록을 DayRenderEventArgs, 참조는 DayRenderEventArgs 생성자입니다.

이벤트를 처리 하는 방법에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.

생성자

DayRenderEventArgs(TableCell, CalendarDay)

지정된 셀 및 달력 날짜를 사용하여 DayRenderEventArgs 클래스의 새 인스턴스를 초기화합니다.

DayRenderEventArgs(TableCell, CalendarDay, String)

지정된 셀, 달력 날짜 및 선택 URL을 사용하여 DayRenderEventArgs 클래스의 새 인스턴스를 초기화합니다.

속성

Cell

TableCell 컨트롤에 렌더링되는 셀을 나타내는 Calendar 개체를 가져옵니다.

Day

CalendarDay 컨트롤에 렌더링되는 날짜를 나타내는 Calendar 개체를 가져옵니다.

SelectUrl

Calendar 컨트롤에서 렌더링될 날짜가 선택될 때 서버에 페이지를 다시 게시하는 데 사용되는 스크립트를 가져옵니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보