Calendar.OtherMonthDayStyle 속성

정의

Calendar 컨트롤의 날짜 중 표시된 달에 속하지 않은 날짜에 대한 스타일 속성을 가져옵니다.

public:
 property System::Web::UI::WebControls::TableItemStyle ^ OtherMonthDayStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.TableItemStyle OtherMonthDayStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.OtherMonthDayStyle : System.Web.UI.WebControls.TableItemStyle
Public ReadOnly Property OtherMonthDayStyle As TableItemStyle

속성 값

TableItemStyle

TableItemStyle 컨트롤의 날짜 중 표시된 달에 속하지 않은 날짜에 대한 스타일 속성이 들어 있는 Calendar입니다. 기본값은 빈 TableItemStyle입니다.

특성

예제

다음 코드 예제에서는 현재 표시 된 월에 없는 컨트롤에 Calendar 일의 연한 회색 전경색을 지정 하는 속성을 사용 OtherMonthDayStyle 하는 방법을 보여 줍니다.

<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Drawing" %>

<!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 OtherMonthDayStyle Example</title>
<script runat="server">

      void Index_Changed(Object sender, EventArgs e)
      {

         // Set the foreground color of days not in the current
         // month to the color selected from the DropDownList control.
         Calendar1.OtherMonthDayStyle.ForeColor = 
            Color.FromName(ColorList.SelectedItem.Value);

      }

   </script>

</head>
<body>

   <form id="form1" runat="server">

      <h3>Calendar OtherMonthDayStyle Example</h3>

      <asp:Calendar id="Calendar1" runat="server">

         <OtherMonthDayStyle ForeColor="LightGray">
         </OtherMonthDayStyle>

      </asp:Calendar>

      <br /><br />

      Select a color for the days not in the current month:

      <br />     
 
      <asp:DropDownList id="ColorList"
           AutoPostBack="True"
           OnSelectedIndexChanged="Index_Changed"
           runat="server">

         <asp:ListItem Value="DarkGray">Dark Gray</asp:ListItem>
         <asp:ListItem Value="LightGray" Selected="True">Light Gray</asp:ListItem>
         <asp:ListItem Value="DarkKhaki">Dark Khaki</asp:ListItem>
         <asp:ListItem Value="Khaki">Khaki</asp:ListItem>
         <asp:ListItem Value="White">White</asp:ListItem>

      </asp:DropDownList>      
            
   </form>
        
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace="System.Drawing" %>

<!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 OtherMonthDayStyle Example</title>
<script runat="server">

      Sub Index_Changed(sender As Object, e As EventArgs)

         ' Set the foreground color of days not in the current
         ' month to the color selected from the DropDownList control.
         Calendar1.OtherMonthDayStyle.ForeColor = _
            Color.FromName(ColorList.SelectedItem.Value)

      End Sub

   </script>

</head>
<body>

   <form id="form1" runat="server">

      <h3>Calendar OtherMonthDayStyle Example</h3>

      <asp:Calendar id="Calendar1" runat="server">

         <OtherMonthDayStyle ForeColor="LightGray">
         </OtherMonthDayStyle>

      </asp:Calendar>

      <br /><br />

      Select a color for the days not in the current month:

      <br />     
 
      <asp:DropDownList id="ColorList"
           AutoPostBack="True"
           OnSelectedIndexChanged="Index_Changed"
           runat="server">

         <asp:ListItem Value="DarkGray">Dark Gray</asp:ListItem>
         <asp:ListItem Value="LightGray" Selected="True">Light Gray</asp:ListItem>
         <asp:ListItem Value="DarkKhaki">Dark Khaki</asp:ListItem>
         <asp:ListItem Value="Khaki">Khaki</asp:ListItem>
         <asp:ListItem Value="White">White</asp:ListItem>

      </asp:DropDownList>      
            
   </form>
        
</body>
</html>

설명

이 속성을 사용 하 여 표시 된 월에 없는 컨트롤에 Calendar 일 스타일을 지정 합니다. OtherMonthDayStyle 속성을 설정하지 않으면 속성에 DayStyle 지정된 스타일이 사용됩니다.

제어할 수 있는 다양한 스타일 속성에 대한 자세한 내용은 다음을 참조하세요 TableItemStyle.

적용 대상

추가 정보