CalendarDay 클래스

정의

Calendar 컨트롤의 날짜를 나타냅니다.

public ref class CalendarDay
public class CalendarDay
type CalendarDay = class
Public Class CalendarDay
상속
CalendarDay

예제

다음 예제에서는 속성을 사용 하는 방법에 설명를 CalendarDay 결정 하는 개체에서 렌더링 될 지 여부를 날짜가 DayRender 표시 된 달의 이벤트는 토요일 이나 일요일에 속하지 않는 합니다. 이러한 날짜는 노란색으로 표시 됩니다. Day 의 속성을 DayRenderEventArgs 개체에 전달를 DayRender 이벤트 처리기가는 CalendarDay 개체.

<%@ 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>ASP.NET Example</title>
<script language="C#" runat="server">

      void DayRender(Object source, DayRenderEventArgs e) 
      {
      
         if (!e.Day.IsOtherMonth && !e.Day.IsWeekend)
            e.Cell.BackColor=System.Drawing.Color.Yellow;
      
      }

   </script>
 
</head>
 
<body>
 
   <form id="form1" runat="server">
 
      <asp:Calendar id="calendar1" runat="server"
           WeekendDayStyle-BackColor="gray"
           OnDayRender="DayRender"/>
                   
   </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>ASP.NET Example</title>
<script language="VB" runat="server">
        Sub DayRender(source As Object, e As DayRenderEventArgs)
            
            If Not e.Day.IsOtherMonth And Not e.Day.IsWeekend Then
                e.Cell.BackColor = System.Drawing.Color.Yellow
            End If 
        End Sub 'DayRender
   </script>
 
</head>
 
<body>
 
   <form id="form1" runat="server">
 
      <asp:Calendar id="calendar1" runat="server"
           WeekendDayStyle-BackColor="gray"
           OnDayRender="DayRender"/>
                   
   </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>
<%@ 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 runat="server">
    <title>Calendar DayRender Example</title>
<script runat="server">
   
      Sub DayRender(sender 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("<br />Holiday"))
         
         End If

      End Sub

      Sub Page_Load(sender As Object, e As EventArgs)

         ' Manually register the event-handling method for the DayRender  
         ' event of the Calendar control.
         AddHandler Calendar1.DayRender, AddressOf DayRender

      End Sub

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

설명

A CalendarDay 개체에서 날짜를 나타내는 Calendar 제어 합니다. 이 클래스에서 사용할 수는 DayRender 이벤트 처리기에서 렌더링 될 때 날짜의 속성을 프로그래밍 방식으로 액세스할 수는 Calendar 컨트롤입니다. 이 옵션을 사용 하면 (예: 날짜 인지 여부를 선택할 수 있는 선택 하면 현재 날짜 또는 주말 날짜) 일의 속성을 확인 하 고 모양이 나 일의 동작을 프로그래밍 방식으로 제어할 수 있습니다.

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

생성자

CalendarDay(DateTime, Boolean, Boolean, Boolean, Boolean, String)

CalendarDay 클래스의 새 인스턴스를 초기화합니다.

속성

Date

이 클래스의 인스턴스에서 나타내는 날짜를 가져옵니다. 이 속성은 읽기 전용입니다.

DayNumberText

CalendarDay 클래스의 인스턴스에서 나타내는 날짜의 날짜 숫자에 해당하는 문자열을 가져옵니다. 이 속성은 읽기 전용입니다.

IsOtherMonth

이 클래스의 인스턴스에서 나타내는 날짜가 Calendar 컨트롤에 표시되지 않은 달에 속하는지 여부를 나타내는 값을 가져옵니다. 이 속성은 읽기 전용입니다.

IsSelectable

이 클래스의 인스턴스에서 나타내는 날짜를 Calendar 컨트롤에서 선택할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

IsSelected

이 클래스의 인스턴스에서 나타내는 날짜가 Calendar 컨트롤에서 선택되었는지 여부를 나타내는 값을 가져옵니다. 이 속성은 읽기 전용입니다.

IsToday

이 클래스의 인스턴스에서 나타내는 날짜가 TodaysDate 컨트롤의 Calendar 속성에서 지정한 날짜와 같은지 여부를 나타내는 값을 가져옵니다. 이 속성은 읽기 전용입니다.

IsWeekend

이 클래스의 인스턴스에서 나타내는 날짜가 토요일이나 일요일인지 여부를 나타내는 값을 가져옵니다. 이 속성은 읽기 전용입니다.

메서드

Equals(Object)

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

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

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

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

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

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

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

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

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

(다음에서 상속됨 Object)

적용 대상

추가 정보