Calendar.SelectionMode 속성

정의

사용자가 하루, 한 주 또는 한 달 전체를 선택할 수 있는지를 지정하는 Calendar 컨트롤의 날짜 선택 모드를 가져오거나 설정합니다.

public:
 property System::Web::UI::WebControls::CalendarSelectionMode SelectionMode { System::Web::UI::WebControls::CalendarSelectionMode get(); void set(System::Web::UI::WebControls::CalendarSelectionMode value); };
[System.ComponentModel.Bindable(true)]
public System.Web.UI.WebControls.CalendarSelectionMode SelectionMode { get; set; }
public System.Web.UI.WebControls.CalendarSelectionMode SelectionMode { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.SelectionMode : System.Web.UI.WebControls.CalendarSelectionMode with get, set
member this.SelectionMode : System.Web.UI.WebControls.CalendarSelectionMode with get, set
Public Property SelectionMode As CalendarSelectionMode

속성 값

CalendarSelectionMode

CalendarSelectionMode 값 중 하나입니다. 기본값은 Day입니다.

특성

예외

지정된 선택 모드가 CalendarSelectionMode 값 중 하나가 아닌 경우

예제

다음 코드 예제에서는 하루, 일주일 또는 전체 달에 의해 날짜 선택을 허용 하려면 속성을 사용 SelectionMode 하는 방법을 보여 줍니다.

<%@ 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>Calendar Example</title>
</head>
<body>

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

      <h3>Calendar Example</h3>

      <asp:Calendar id="calendar1" runat="server"
           SelectionMode="DayWeekMonth"/>
            
   </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>Calendar Example</title>
</head>
<body>

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

      <h3>Calendar Example</h3>

      <asp:Calendar id="calendar1" runat="server"
           SelectionMode="DayWeekMonth"/>
            
   </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" >
   <script runat="server" >
  
      void Selection_Change(Object sender, EventArgs e)
      {

         // Set the day selection mode.
         Calendar1.SelectionMode = 
            (CalendarSelectionMode)ModeList.SelectedIndex;

      }
  
   </script>
  
<head runat="server">
    <title> Calendar SelectionMode Example </title>
</head>
<body>

   <form id="form1" runat="server">
  
      <h3> Calendar SelectionMode Example </h3>

      Choose the date selection mode.

      <br /><br /> 
  
      <asp:Calendar id="Calendar1"
           ShowGridLines="True" 
           ShowTitle="True"
           runat="server"/>

      <br /><br />

      <table cellpadding="5">

         <tr>

            <td>

               Mode:

            </td>

         </tr>

         <tr>

            <td>

               <asp:DropDownList id="ModeList"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="Selection_Change"
                    runat="server">

                  <asp:ListItem> None </asp:ListItem>
                  <asp:ListItem Selected="True"> Day </asp:ListItem>
                  <asp:ListItem> DayWeek </asp:ListItem>
                  <asp:ListItem> DayWeekMonth </asp:ListItem>

               </asp:DropDownList>

            </td>

         </tr>
  
      </table>
  
   </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" >
   <script runat="server" >
  
      Sub Selection_Change(sender As Object, e As EventArgs)

         ' Set the day selection mode.
         Calendar1.SelectionMode = _
            CType(ModeList.SelectedIndex, CalendarSelectionMode)

      End Sub
  
   </script>
  
<head runat="server">
    <title> Calendar SelectionMode Example </title>
</head>
<body>

   <form id="form1" runat="server">
  
      <h3> Calendar SelectionMode Example </h3>

      Choose the date selection mode.

      <br /><br /> 
  
      <asp:Calendar id="Calendar1"
           ShowGridLines="True" 
           ShowTitle="True"
           runat="server"/>

      <br /><br />

      <table cellpadding="5">

         <tr>

            <td>

               Mode:

            </td>

         </tr>

         <tr>

            <td>

               <asp:DropDownList id="ModeList"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="Selection_Change"
                    runat="server">

                  <asp:ListItem> None </asp:ListItem>
                  <asp:ListItem Selected="True"> Day </asp:ListItem>
                  <asp:ListItem> DayWeek </asp:ListItem>
                  <asp:ListItem> DayWeekMonth </asp:ListItem>

               </asp:DropDownList>

            </td>

         </tr>
  
      </table>
  
   </form>

</body>
</html>

설명

컨트롤에서 SelectionMode 날짜 선택 모드 Calendar 를 지정하려면 이 속성을 사용합니다. 이 속성 중 하나를 사용 하 여는 CalendarSelectionMode 열거형 값입니다. 사용자가 하루, 일주일 또는 전체 월을 선택할 수 있는지 여부를 지정하거나 날짜 선택 기능을 완전히 사용하지 않도록 설정할 수 있습니다.

이 속성을 설정하거나 CalendarSelectionMode.DayWeekMonth설정 CalendarSelectionMode.DayWeek 하면 주 및 월 선택 컨트롤이 포함된 추가 선택기 열이 컨트롤의 Calendar 첫 번째 열에 표시됩니다. 속성을 SelectorStyle 사용하여 이 열의 모양을 사용자 지정합니다.

날짜 선택을 사용하지 않으려면 이 속성을 .로 CalendarSelectionMode.None설정합니다.

적용 대상

추가 정보