FirstDayOfWeek 枚举
指定在 Calendar 控件上显示为一周的第一天的日期。
**命名空间:**System.Web.UI.WebControls
**程序集:**System.Web(在 system.web.dll 中)
语法
声明
Public Enumeration FirstDayOfWeek
用法
Dim instance As FirstDayOfWeek
public enum FirstDayOfWeek
public enum class FirstDayOfWeek
public enum FirstDayOfWeek
public enum FirstDayOfWeek
成员
成员名称 | 说明 | |
---|---|---|
Default | 指示一周的第一天由系统设置指定。 | |
Friday | 指示一周的第一天为星期五。 | |
Monday | 指示一周的第一天为星期一。 | |
Saturday | 指示一周的第一天为星期六。 | |
Sunday | 指示一周的第一天为星期日。 | |
Thursday | 指示一周的第一天为星期四。 | |
Tuesday | 指示一周的第一天为星期二。 | |
Wednesday | 指示一周的第一天为星期三。 |
备注
FirstDayOfWeek 枚举表示指定在 Calendar 控件上将哪一天显示为一周的第一天的值。
示例
下面的代码示例演示如何使用下拉列表将 Calendar 控件设置为一周的第一天。
<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
<script runat="server" >
Sub Selection_Change(sender as Object, e As EventArgs)
' Set the first day of the week.
Calendar1.FirstDayOfWeek = CType(DayList.SelectedIndex, _
System.Web.UI.WebControls.FirstDayOfWeek)
End Sub
</script>
<body>
<form runat="server">
<h3> Calendar FirstDayOfWeek Example </h3>
Select the first day of the week.
<br><br>
<asp:Calendar id="Calendar1"
ShowGridLines="True"
ShowTitle="True"
runat="server"/>
<br><br>
<table cellpadding="5">
<tr>
<td>
First day of the week:
</td>
</tr>
<tr>
<td>
<asp:DropDownList id="DayList"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem> Sunday </asp:ListItem>
<asp:ListItem> Monday </asp:ListItem>
<asp:ListItem> Tuesday </asp:ListItem>
<asp:ListItem> Wednesday </asp:ListItem>
<asp:ListItem> Thursday </asp:ListItem>
<asp:ListItem> Friday </asp:ListItem>
<asp:ListItem> Saturday </asp:ListItem>
<asp:ListItem Selected="True"> Default </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 first day of the week.
Calendar1.FirstDayOfWeek = (FirstDayOfWeek)DayList.SelectedIndex;
}
</script>
<body>
<form runat="server">
<h3> Calendar FirstDayOfWeek Example </h3>
Select the first day of the week.
<br><br>
<asp:Calendar id="Calendar1"
ShowGridLines="True"
ShowTitle="True"
runat="server"/>
<br><br>
<table cellpadding="5">
<tr>
<td>
First day of the week:
</td>
</tr>
<tr>
<td>
<asp:DropDownList id="DayList"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem> Sunday </asp:ListItem>
<asp:ListItem> Monday </asp:ListItem>
<asp:ListItem> Tuesday </asp:ListItem>
<asp:ListItem> Wednesday </asp:ListItem>
<asp:ListItem> Thursday </asp:ListItem>
<asp:ListItem> Friday </asp:ListItem>
<asp:ListItem> Saturday </asp:ListItem>
<asp:ListItem Selected="True"> Default </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.FirstDayOfWeek 属性