CalendarSelectionMode 枚举

指定 Calendar 控件的日期选择模式。

**命名空间:**System.Web.UI.WebControls
**程序集:**System.Web(在 system.web.dll 中)

语法

声明
Public Enumeration CalendarSelectionMode
用法
Dim instance As CalendarSelectionMode
public enum CalendarSelectionMode
public enum class CalendarSelectionMode
public enum CalendarSelectionMode
public enum CalendarSelectionMode

成员

  成员名称 说明
Day 可以在 Calendar 控件上选择单个日期。 
DayWeek 可以在 Calendar 控件上选择单日或整周。 
DayWeekMonth 可以在 Calendar 控件上选择单个日期、周或整月。 
None Calendar 控件上不能选择任何日期。 

备注

CalendarSelectionMode 枚举表示 Calendar 控件的日期选择模式。

示例

<%@ Page Language="VB" AutoEventWireup="True" %>

<html>
   <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>
  
<body>

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

</body>
</html>
 
<%@ Page Language="C#" AutoEventWireup="True" %>

<html>
   <script runat="server" >
  
      void Selection_Change(Object sender, EventArgs e)
      {

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

      }
  
   </script>
  
<body>

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

</body>
</html>
 

平台

Windows 98、Windows 2000 SP4、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

System.Web.UI.WebControls 命名空间
Calendar 类
Calendar.SelectionMode 属性

其他资源

Calendar Web 服务器控件