CalendarSelectionMode 列舉
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定 Calendar 控制項的日期選取模式。
public enum class CalendarSelectionMode
public enum CalendarSelectionMode
type 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 日期選取模式。