Export (0) Print
Expand All
Expand Minimize

DayNameFormat Enumeration

Specifies the display format for the days of the week on a Calendar control.

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

Remarks

The DayNameFormat enumeration represents the display formats for the days of the week on a Calendar control.

Members

Member name Description
FirstLetter The days of the week displayed with just the first letter. For example, T.
FirstTwoLetters The days of the week displayed with just the first two letters. For example, Tu.
Full The days of the week displayed in full format. For example, Tuesday.
Short The days of the week displayed in abbreviated format. For example, Tues.

Example

[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>

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

         ' Set display format for the days of the week.
         Calendar1.DayNameFormat = _
            CType(DayNameList.SelectedIndex, DayNameFormat)

      End Sub
  
   </script>
  
<body>

   <form runat="server">
  
      <h3> Calendar DayNameFormat Example </h3>

      Select a display style for the days of the week.

      <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="DayNameList"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="Selection_Change"
                    runat="server">

                  <asp:ListItem> Full </asp:ListItem>
                  <asp:ListItem Selected="True"> Short </asp:ListItem>
                  <asp:ListItem> FirstLetter </asp:ListItem>
                  <asp:ListItem> FirstTwoLetters </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 display format for the days of the week.
         Calendar1.DayNameFormat = 
            (DayNameFormat)DayNameList.SelectedIndex;

      }
  
   </script>
  
<body>

   <form runat="server">
  
      <h3> Calendar DayNameFormat Example </h3>

      Select a display style for the days of the week.

      <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="DayNameList"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="Selection_Change"
                    runat="server">

                  <asp:ListItem> Full </asp:ListItem>
                  <asp:ListItem Selected="True"> Short </asp:ListItem>
                  <asp:ListItem> FirstLetter </asp:ListItem>
                  <asp:ListItem> FirstTwoLetters </asp:ListItem>

               </asp:DropDownList>

            </td>

         </tr>
  
   </form>

</body>
</html>
 

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic 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 | DayNameFormat

Show:
© 2014 Microsoft