Freigeben über


TitleFormat-Enumeration

Gibt das Titelformat für den angezeigten Monat im Calendar-Steuerelement an.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

Syntax

'Declaration
Public Enumeration TitleFormat
'Usage
Dim instance As TitleFormat
public enum TitleFormat
public enum class TitleFormat
public enum TitleFormat
public enum TitleFormat

Member

  Membername Beschreibung
Month Zeigt den Titel mit dem Monat, aber nicht mit der Jahreszahl an (z. B. "January"). 
MonthYear Zeigt den Titel sowohl mit dem Monat als auch mit dem Jahr an (z. B. "January 2000"). 

Hinweise

Die TitleFormat-Enumeration stellt die verschiedenen Titelformate für das Calendar-Steuerelement dar.

Beispiel

Im folgenden Beispiel wird veranschaulicht, wie Sie den Kalendertitel vom Standardformat (MonthYear) in das Month-Format ändern. Erstellen Sie zum Ausführen des Beispiels eine Web Forms-Seite mit dem Namen WebForm1, und ersetzen Sie die Page_load-Methode durch den Beispielcode.

Private Sub Page_Load(sender As Object, e As System.EventArgs)
   ' Change the title format of Calendar1.
   Calendar1.TitleFormat = TitleFormat.Month
End Sub 'Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
   // Change the title format of Calendar1.
   Calendar1.TitleFormat = TitleFormat.Month;
}
private void Page_Load(Object sender, System.EventArgs e)
{
    // Change the title format of Calendar1.
    calendar1.set_TitleFormat(TitleFormat.Month);
} //Page_Load
<%@ Page Language="VB" AutoEventWireup="True" %>

<html>
   <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>
  
<body>

   <form 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>
  
   </form>

</body>
</html>
 
<%@ Page Language="C#" AutoEventWireup="True" %>

<html>
   <script runat="server" >
  
      void Selection_Change(Object sender, EventArgs e)
      {

         // Set the title format.
         Calendar1.TitleFormat = (TitleFormat)ModeList.SelectedIndex;

      }
  
   </script>
  
<body>

   <form 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>
  
   </form>

</body>
</html>
 

Plattformen

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 unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

System.Web.UI.WebControls-Namespace
Calendar-Klasse
Calendar.TitleFormat-Eigenschaft