タイトル セクションの書式を取得または設定します。
名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文
'宣言
Public Property TitleFormat As TitleFormat
'使用
Dim instance As Calendar
Dim value As TitleFormat
value = instance.TitleFormat
instance.TitleFormat = value
public TitleFormat TitleFormat { get; set; }
public:
property TitleFormat TitleFormat {
TitleFormat get ();
void set (TitleFormat value);
}
/** @property */
public TitleFormat get_TitleFormat ()
/** @property */
public void set_TitleFormat (TitleFormat value)
public function get TitleFormat () : TitleFormat
public function set TitleFormat (value : TitleFormat)
適用できません。
プロパティ値
TitleFormat 値の 1 つ。既定値は MonthYear です。
例外
例外の種類 | 条件 |
---|---|
指定されたタイトル書式が、TitleFormat 値ではありません。 |
解説
TitleFormat プロパティを使用して、タイトル セクションの書式を指定します。このプロパティは、TitleFormat 列挙値の 1 つに設定します。タイトルに月を表示するか、月と年の両方を表示するかを指定できます。
このプロパティは、ShowTitle プロパティが true に設定されている場合にだけ適用されます。
トピック | 場所 |
---|---|
方法 : Calendar Web サーバー コントロールの表示形式をカスタマイズする | Visual Studio ASP .NET での Web アプリケーションの作成 |
方法 : Calendar Web サーバー コントロールの表示形式をカスタマイズする | Visual Studio ASP .NET での Web アプリケーションの作成 |
方法 : Calendar Web サーバー コントロールの表示形式をカスタマイズする | ASP .NET Web アプリケーションの作成 |
使用例
TitleFormat プロパティを使用して、タイトル セクションに月と年を表示する方法を次のコード例に示します。
<%@ 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" >
<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="JScript" 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" >
<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>
<%@ 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>
プラットフォーム
Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition
Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。
バージョン情報
.NET Framework
サポート対象 : 3.0,2.0,1.1,1.0
参照
関連項目
Calendar クラス
Calendar メンバ
System.Web.UI.WebControls 名前空間
Calendar.ShowTitle プロパティ