Calendar.NextPrevFormat Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém ou define o formato dos elementos de navegação do mês seguinte e anterior na secção de título do Calendar controlo.
public:
property System::Web::UI::WebControls::NextPrevFormat NextPrevFormat { System::Web::UI::WebControls::NextPrevFormat get(); void set(System::Web::UI::WebControls::NextPrevFormat value); };
[System.ComponentModel.Bindable(true)]
public System.Web.UI.WebControls.NextPrevFormat NextPrevFormat { get; set; }
public System.Web.UI.WebControls.NextPrevFormat NextPrevFormat { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.NextPrevFormat : System.Web.UI.WebControls.NextPrevFormat with get, set
member this.NextPrevFormat : System.Web.UI.WebControls.NextPrevFormat with get, set
Public Property NextPrevFormat As NextPrevFormat
Valor de Propriedade
Um dos NextPrevFormat valores. O valor predefinido é CustomText.
- Atributos
Exceções
O formato especificado não é um dos valores NextPrevFormat .
Exemplos
O seguinte exemplo de código demonstra como usar a NextPrevFormat propriedade para especificar o formato de mês curto para os controlos de navegação.
<%@ 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"
ShowNextPrevMonth="true"
NextPrevFormat="ShortMonth"/>
</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"
ShowNextPrevMonth="True"
NextPrevFormat="ShortMonth"/>
</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 format for the next and previous month controls.
Calendar1.NextPrevFormat = (NextPrevFormat)DayList.SelectedIndex;
}
</script>
<head runat="server">
<title> Calendar NextPrevFormat Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> Calendar NextPrevFormat Example </h3>
Select a format for the next and previous month controls.
<br /><br />
<asp:Calendar id="Calendar1"
ShowGridLines="True"
ShowTitle="True"
runat="server"/>
<br /><br />
<table cellpadding="5">
<tr>
<td>
Format:
</td>
</tr>
<tr>
<td>
<asp:DropDownList id="DayList"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem Selected="True"> Custom </asp:ListItem>
<asp:ListItem> ShortMonth </asp:ListItem>
<asp:ListItem> FullMonth </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 format for the next and previous month controls.
Calendar1.NextPrevFormat = _
CType(DayList.SelectedIndex, NextPrevFormat)
End Sub
</script>
<head runat="server">
<title> Calendar NextPrevFormat Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> Calendar NextPrevFormat Example </h3>
Select a format for the next and previous month controls.
<br /><br />
<asp:Calendar id="Calendar1"
ShowGridLines="True"
ShowTitle="True"
runat="server"/>
<br /><br />
<table cellpadding="5">
<tr>
<td>
Format:
</td>
</tr>
<tr>
<td>
<asp:DropDownList id="DayList"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem Selected="True"> Custom </asp:ListItem>
<asp:ListItem> ShortMonth </asp:ListItem>
<asp:ListItem> FullMonth </asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</form>
</body>
</html>
Observações
Use a NextPrevFormat propriedade para especificar o formato dos elementos de navegação do mês seguinte e anterior no Calendar controlo. Esta propriedade é definida com um dos valores de NextPrevFormat enumeração. Pode especificar se o texto dos controlos de navegação é apresentado como o nome completo do mês, o nome do mês curto (abreviado) ou texto personalizado.
Para especificar um texto de navegação personalizado, defina esta propriedade para NextPrevFormat.CustomText e defina as NextMonthText propriedades e PrevMonthText para o texto personalizado.
Esta propriedade aplica-se apenas se a ShowNextPrevMonth propriedade estiver definida como true.