Skip to main content
Tab

CalendarProperties.DayNameFormat Property

Gets or sets the name format for days of the week.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

[DefaultValue(DayNameFormat.Short)]
public DayNameFormat DayNameFormat { get; set; }

Property Value

Type Default Description
DayNameFormat Short

A DayNameFormat enumeration value.

Remarks

This property applies only if the ASPxCalendar.ShowDayHeaders property is set to true.

The day names are based on the server’s local settings.

Note

The DayNameFormat property synchronizes its value with the editor’s ASPxCalendar.DayNameFormat property.

Example

This example demonstrates how to customize the appearance of different visual elements within the ASPxCalendar control.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
     protected void Page_Load(object sender, EventArgs e) {

     }
     protected void ddlDayNameFormat_SelectedIndexChanged(object sender, EventArgs e) {
      myCalendar.DayNameFormat = (DayNameFormat)Enum.Parse(typeof(DayNameFormat),
          ((DropDownList)sender).SelectedValue.ToString());
     }
     protected void ddlFirstDayOfWeek_SelectedIndexChanged(object sender, EventArgs e) {
      myCalendar.FirstDayOfWeek = (FirstDayOfWeek)Enum.Parse(typeof(FirstDayOfWeek),
          ((DropDownList)sender).SelectedValue.ToString());
     }

     protected void cbEnableMonthNavigation_CheckedChanged(object sender, EventArgs e) {
       myCalendar.EnableMonthNavigation = ((CheckBox)sender).Checked;
     }
     protected void cbEnableYearNavigation_CheckedChanged(object sender, EventArgs e) {
       myCalendar.EnableYearNavigation = ((CheckBox)sender).Checked;
     }
     protected void cbReadOnly_CheckedChanged(object sender, EventArgs e) {
       myCalendar.ReadOnly = ((CheckBox)sender).Checked;
     }
     protected void cbShowClearButton_CheckedChanged(object sender, EventArgs e) {
       myCalendar.ShowClearButton = ((CheckBox)sender).Checked;
     }
     protected void cbShowDayHeaders_CheckedChanged(object sender, EventArgs e) {
       myCalendar.ShowDayHeaders = ((CheckBox)sender).Checked;
     }
     protected void cbShowDefaultWeekends_CheckedChanged(object sender, EventArgs e) {
       myCalendar.HighlightWeekends = ((CheckBox)sender).Checked;
     }
     protected void cbShowHeader_CheckedChanged(object sender, EventArgs e) {
       myCalendar.ShowHeader = ((CheckBox)sender).Checked;
     }
     protected void cbShowTodayButton_CheckedChanged(object sender, EventArgs e) {
       myCalendar.ShowTodayButton = ((CheckBox)sender).Checked;
     }
     protected void cbShowWeekNumbers_CheckedChanged(object sender, EventArgs e) {
       myCalendar.ShowWeekNumbers = ((CheckBox)sender).Checked;
     }
</script>

 <html xmlns="http://www.w3.org/1999/xhtml" >
 <head id="Head1" runat="server">
     <title>Showing/hiding calendar elements</title>
     <style type="text/css">
         tr.BeginGroup td {
             border-top: 1px Solid Silver;
             padding-top: 10px;
         }
     </style>
 </head>
 <body>
     <form id="form1" runat="server">
     <div>    
         <br/>
         <table width="100%" border="0" style="border: 1px Solid Silver;" 
          cellpadding="0" cellspacing="10"><tr>
             <td valign="top">
                 <dxe:ASPxCalendar ID="myCalendar" runat="server">
                 </dxe:ASPxCalendar>
             </td>
             <td valign="top" style="width: 100%;">
                 <table cellpadding="0" border="0" cellspacing="10" 
                   style="border-left: 1px Solid Silver;"><tr>
                     <td align="left" valign="top"><asp:Label ID="Label1" runat="server" 
                      Text="DayNameFormat:" AssociatedControlID="ddlDayNameFormat" />
                      </td>
                     <td valign="top">
                    <asp:DropDownList ID="ddlDayNameFormat" runat="server" 
                    AutoPostBack="True" 
                    OnSelectedIndexChanged="ddlDayNameFormat_SelectedIndexChanged">
                             <asp:ListItem>FirstLetter</asp:ListItem>
                             <asp:ListItem>FirstTwoLetters</asp:ListItem>
                             <asp:ListItem>Full</asp:ListItem>
                             <asp:ListItem Selected="True">Short</asp:ListItem>
                             <asp:ListItem>Shortest</asp:ListItem>
                         </asp:DropDownList>
                     </td>
                 </tr><tr>
                     <td align="left" valign="top"><asp:Label ID="Label6" runat="server" 
                     Text="FirstDayOfWeek:" AssociatedControlID="ddlFirstDayOfWeek" /></td>
                     <td valign="top">
                      <asp:DropDownList ID="ddlFirstDayOfWeek" runat="server" 
                       AutoPostBack="True" 
                           OnSelectedIndexChanged="ddlFirstDayOfWeek_SelectedIndexChanged">
                             <asp:ListItem Selected="True">Default</asp:ListItem>
                             <asp:ListItem>Sunday</asp:ListItem>
                             <asp:ListItem>Monday</asp:ListItem>
                             <asp:ListItem>Tuesday</asp:ListItem>
                             <asp:ListItem>Wednesday</asp:ListItem>
                             <asp:ListItem>Thursday</asp:ListItem>
                             <asp:ListItem>Friday</asp:ListItem>
                             <asp:ListItem>Saturday</asp:ListItem>
                         </asp:DropDownList>
                     </td>
                 </tr><tr class="BeginGroup">
                     <td align="left" valign="top"><asp:Label ID="Label2" runat="server" 
                    Text="EnableMonthNavigation:" 
                    AssociatedControlID="cbEnableMonthNavigation" />
                      </td>
                     <td valign="top">
                         <asp:CheckBox ID="cbEnableMonthNavigation" runat="server" 
                          Checked="True" 
                          AutoPostBack="True" 
                          OnCheckedChanged="cbEnableMonthNavigation_CheckedChanged" />
                     </td>
                 </tr><tr>
                     <td align="left" valign="top"><asp:Label ID="Label3" runat="server" 
                     Text="EnableYearNavigation:" 
                     AssociatedControlID="cbEnableYearNavigation" />
                     </td>
                     <td valign="top">
                         <asp:CheckBox ID="cbEnableYearNavigation" runat="server" 
                         Checked="True" 
                         AutoPostBack="True" 
                         OnCheckedChanged="cbEnableYearNavigation_CheckedChanged" />
                     </td>
                 </tr><tr class="BeginGroup">
                     <td align="left" valign="top"><asp:Label ID="Label7" runat="server" 
                     Text="ReadOnly:" AssociatedControlID="cbReadOnly" /></td>
                     <td valign="top">
                         <asp:CheckBox ID="cbReadOnly" runat="server" Checked="False" 
                         AutoPostBack="True" 
                         OnCheckedChanged="cbReadOnly_CheckedChanged" />
                     </td>
                 </tr><tr class="BeginGroup">
                     <td align="left" valign="top"><asp:Label ID="Label8" runat="server" 
                     Text="ShowClearButton:" AssociatedControlID="cbShowClearButton" />
                     </td>
                     <td valign="top">
                         <asp:CheckBox ID="cbShowClearButton" runat="server" 
                        Checked="True"  
                         AutoPostBack="True" 
                         OnCheckedChanged="cbShowClearButton_CheckedChanged" />
                     </td>
                 </tr><tr>
                     <td align="left" valign="top"><asp:Label ID="Label12" runat="server" 
                     Text="ShowTodayButton:" AssociatedControlID="cbShowTodayButton" />
                     </td>
                     <td valign="top">
                         <asp:CheckBox ID="cbShowTodayButton" runat="server" 
                         Checked="True" 
                         AutoPostBack="True" 
                         OnCheckedChanged="cbShowTodayButton_CheckedChanged" />
                     </td>
                 </tr><tr class="BeginGroup">
                     <td align="left" valign="top"><asp:Label ID="Label9" runat="server" 
                     Text="ShowDayHeaders:" AssociatedControlID="cbShowDayHeaders" />
                     </td>
                     <td valign="top">
                         <asp:CheckBox ID="cbShowDayHeaders" runat="server" 
                         Checked="True" 
                         AutoPostBack="True" 
                         OnCheckedChanged="cbShowDayHeaders_CheckedChanged" />
                     </td>
                 </tr><tr>
                     <td align="left" valign="top"><asp:Label ID="Label11" runat="server" 
                     Text="ShowHeader:" AssociatedControlID="cbShowHeader" />
                     </td>
                     <td valign="top">
                         <asp:CheckBox ID="cbShowHeader" runat="server" Checked="True" 
                         AutoPostBack="True" 
                         OnCheckedChanged="cbShowHeader_CheckedChanged" />
                     </td>
                 </tr><tr>
                     <td align="left" valign="top"><asp:Label ID="Label10" runat="server" 
                     Text="HighlightWeekends:" 
                     AssociatedControlID="cbShowDefaultWeekends" />
                     </td>
                     <td valign="top">
                         <asp:CheckBox ID="cbShowDefaultWeekends" runat="server" 
                         Checked="True" 
                         AutoPostBack="True" 
                         OnCheckedChanged="cbShowDefaultWeekends_CheckedChanged" />
                     </td>
                 </tr><tr>
                     <td align="left" valign="top"><asp:Label ID="Label13" runat="server" 
                     Text="ShowWeekNumbers:"
                     AssociatedControlID="cbShowWeekNumbers" />
                     </td>
                     <td valign="top">
                        <asp:CheckBox ID="cbShowWeekNumbers" runat="server" 
                        Checked="True"
                        AutoPostBack="True" 
                       OnCheckedChanged="cbShowWeekNumbers_CheckedChanged" />
                     </td>
                 </tr>
                 </table>
             </td>
         </tr></table>
     </div>
     </form>
 </body>
 </html>
See Also