Calendar.TitleFormat Własność
Definicja
Ważny
Niektóre informacje dotyczą produktów przedpremierowych, które mogą zostać znacznie zmodyfikowane przed premierą. Microsoft nie udziela żadnych gwarancji, ani wyraźnych, ani domniemanych, dotyczących informacji podanych tutaj.
Pobiera lub ustawia format sekcji tytułu.
public:
property System::Web::UI::WebControls::TitleFormat TitleFormat { System::Web::UI::WebControls::TitleFormat get(); void set(System::Web::UI::WebControls::TitleFormat value); };
[System.ComponentModel.Bindable(true)]
public System.Web.UI.WebControls.TitleFormat TitleFormat { get; set; }
public System.Web.UI.WebControls.TitleFormat TitleFormat { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.TitleFormat : System.Web.UI.WebControls.TitleFormat with get, set
member this.TitleFormat : System.Web.UI.WebControls.TitleFormat with get, set
Public Property TitleFormat As TitleFormat
Wartość nieruchomości
TitleFormat Jedna z wartości. Wartość domyślna to MonthYear.
- Atrybuty
Wyjątki
Określony format tytułu nie jest jedną z TitleFormat wartości.
Przykłady
W poniższym przykładzie kodu pokazano, jak używać TitleFormat właściwości do wyświetlania miesiąca i roku w sekcji tytułu.
<%@ 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"
TitleFormat="MonthYear"/>
</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"
TitleFormat="MonthYear"/>
</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 title format.
Calendar1.TitleFormat = (TitleFormat)ModeList.SelectedIndex;
}
</script>
<head runat="server">
<title> Calendar TitleFormat Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> Calendar TitleFormat Example </h3>
Choose the title format.
<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="ModeList"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem> Month </asp:ListItem>
<asp:ListItem Selected="True"> MonthYear </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 title format.
Calendar1.TitleFormat = CType(ModeList.SelectedIndex, TitleFormat)
End Sub
</script>
<head runat="server">
<title> Calendar TitleFormat Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> Calendar TitleFormat Example </h3>
Choose the title format.
<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="ModeList"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem> Month </asp:ListItem>
<asp:ListItem Selected="True"> MonthYear </asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</form>
</body>
</html>
Uwagi
TitleFormat Użyj właściwości , aby określić format sekcji tytułu. Ta właściwość jest ustawiana przy użyciu jednej z TitleFormat wartości wyliczenia. Możesz określić, czy tytuł jest wyświetlany jako miesiąc, czy zarówno miesiąc, jak i rok.
Ta właściwość ma zastosowanie tylko wtedy, gdy właściwość jest ustawiona ShowTitle na truewartość .