CalendarSelectionMode 枚举  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定 Calendar 控件的日期选择模式。
public enum class CalendarSelectionModepublic enum CalendarSelectionModetype CalendarSelectionMode = Public Enum CalendarSelectionMode- 继承
字段
| 名称 | 值 | 说明 | 
|---|---|---|
| Day | 1 | 可以在 Calendar 控件上选择单个日期。 | 
| DayWeek | 2 | 可以在 Calendar 控件上选择单日或整周。 | 
| DayWeekMonth | 3 | 可以在 Calendar 控件上选择单个日期、周或整月。 | 
| None | 0 | 在 Calendar 控件上不能选择任何日期。 | 
示例
<%@ 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>
注解
CalendarSelectionMode枚举表示控件的Calendar日期选择模式。