This documentation is archived and is not being maintained.

TitleFormat Enumeration

Specifies the title format for the displayed month in the Calendar control.

[Visual Basic]
<Serializable>
Public Enum TitleFormat
[C#]
[Serializable]
public enum TitleFormat
[C++]
[Serializable]
__value public enum TitleFormat
[JScript]
public
   Serializable
enum TitleFormat

Remarks

The TitleFormat enumeration represents the different title formats for the Calendar control.

Members

Member name Description
Month Title displayed with only the month but not the year. For example, "January".
MonthYear Title displayed with both the month and the year. For example, "January 2000".

Example

[Visual Basic, C#, C++] In this example, you change the calendar title from the default format (MonthYear) to the Month format. To run the example, create a Web Forms page named WebForm1, and replace the Page_load method with the example code.

[Visual Basic] 
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

[C#] 
private void Page_Load(object sender, System.EventArgs e)
{
   // Change the title format of Calendar1.
   Calendar1.TitleFormat = TitleFormat.Month;
}

[C++] 
private:
    void Page_Load(Object* /*sender*/, System::EventArgs* /*e*/)
    {
        // Change the title format of Calendar1.
        Calendar1->TitleFormat = TitleFormat::Month;
    }

[Visual Basic] 
<%@ 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>
 

[C#] 
<%@ 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>
 

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Web.UI.WebControls

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web (in System.Web.dll)

See Also

System.Web.UI.WebControls Namespace | Calendar | TitleFormat

Show: