Calendar.NextPrevFormat プロパティ
アセンブリ: System.Web (system.web.dll 内)
構文
Dim instance As Calendar Dim value As NextPrevFormat value = instance.NextPrevFormat instance.NextPrevFormat = value
public: property NextPrevFormat NextPrevFormat { NextPrevFormat get (); void set (NextPrevFormat value); }
/** @property */ public NextPrevFormat get_NextPrevFormat () /** @property */ public void set_NextPrevFormat (NextPrevFormat value)
public function get NextPrevFormat () : NextPrevFormat public function set NextPrevFormat (value : NextPrevFormat)
NextPrevFormat 値の 1 つ。既定値は CustomText です。
解説
NextPrevFormat プロパティを使用して、Calendar コントロールの前後の月へのナビゲーション要素の書式を指定します。このプロパティは、NextPrevFormat 列挙値の 1 つに設定します。ナビゲーション コントロールに表示されるテキストを月の完全名にするか、月の短い名前 (省略名) にするか、またはカスタム テキストにするかを指定できます。
カスタム ナビゲーション テキストを指定するには、このプロパティを NextPrevFormat.CustomText に設定し、NextMonthText プロパティと PrevMonthText プロパティをカスタム テキストに設定します。
このプロパティは、ShowNextPrevMonth プロパティが true に設定されている場合にだけ適用されます。
NextPrevFormat プロパティを使用して、ナビゲーション コントロールに月の短い名前の書式を指定する方法を次のコード例に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> </head> <body> <form runat="server"> <h3>Calendar Example</h3> <asp:Calendar id="calendar1" runat="server" ShowNextPrev="True" NextPrevFormat="ShortMonth"/> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> </head> <body> <form runat="server"> <h3>Calendar Example</h3> <asp:Calendar id="calendar1" runat="server" ShowNextPrev="True" NextPrevFormat="ShortMonth"/> </form> </body> </html>
<%@ Page Language="JScript" AutoEventWireup="True" %> <html> <head> </head> <body> <form runat="server"> <h3>Calendar Example</h3> <asp:Calendar id="calendar1" runat="server" ShowNextPrev="True" NextPrevFormat="ShortMonth"/> </form> </body> </html>
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <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> <body> <form 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> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <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> <body> <form 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> </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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- Calendar.NextPrevFormat プロパティのページへのリンク