Calendar.FirstDayOfWeek Propriedade
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Obtém ou define o dia da semana a ser exibido na primeira coluna de dia do controle Calendar.
public:
property System::Web::UI::WebControls::FirstDayOfWeek FirstDayOfWeek { System::Web::UI::WebControls::FirstDayOfWeek get(); void set(System::Web::UI::WebControls::FirstDayOfWeek value); };
[System.ComponentModel.Bindable(true)]
public System.Web.UI.WebControls.FirstDayOfWeek FirstDayOfWeek { get; set; }
public System.Web.UI.WebControls.FirstDayOfWeek FirstDayOfWeek { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.FirstDayOfWeek : System.Web.UI.WebControls.FirstDayOfWeek with get, set
member this.FirstDayOfWeek : System.Web.UI.WebControls.FirstDayOfWeek with get, set
Public Property FirstDayOfWeek As FirstDayOfWeek
Valor da propriedade
Um dos valores de FirstDayOfWeek. O padrão é Default
, que indica que o dia especificado na configuração do sistema é usado.
- Atributos
Exceções
A data especificada não é um dos valores FirstDayOfWeek.
Exemplos
O exemplo de código a seguir demonstra como usar a FirstDayOfWeek propriedade para definir a coluna do primeiro dia como segunda-feira.
<%@ 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"
FirstDayOfWeek="Monday"/>
</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"
FirstDayOfWeek="Monday"/>
</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 first day of the week.
Calendar1.FirstDayOfWeek = (FirstDayOfWeek)DayList.SelectedIndex;
}
</script>
<head runat="server">
<title> Calendar FirstDayOfWeek Example </title>
</head>
<body>
<form id="form1" 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>
</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 first day of the week.
Calendar1.FirstDayOfWeek = CType(DayList.SelectedIndex, _
System.Web.UI.WebControls.FirstDayOfWeek)
End Sub
</script>
<head runat="server">
<title> Calendar FirstDayOfWeek Example </title>
</head>
<body>
<form id="form1" 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>
</table>
</form>
</body>
</html>
Comentários
Use a FirstDayOfWeek propriedade para especificar o dia da semana a ser exibido na coluna do primeiro dia do Calendar controle. Essa propriedade é definida com um dos valores de FirstDayOfWeek enumeração. Você pode especificar qualquer dia da semana ou FirstDayOfWeek.Default
, o que indica que a data é determinada pelas configurações do sistema.