DayNameFormat 列舉

定義

指定 Calendar 控制項上星期的顯示格式。

public enum class DayNameFormat
public enum DayNameFormat
type DayNameFormat = 
Public Enum DayNameFormat
繼承
DayNameFormat

欄位

FirstLetter 2

只以第一個字母顯示的星期。 例如,M 表示星期一。

FirstTwoLetters 3

只以頭兩個字母顯示的星期。 例如,Mo 表示星期一。

Full 0

以完整格式顯示的星期。 例如,Monday。

Short 1

以縮寫格式顯示的星期。 例如,Mon 表示星期一。

Shortest 4

為目前的文化特性,以最簡短縮寫格式顯示星期。

範例

下列程式碼範例示範如何在 控制項中 Calendar 指定星期幾的格式格式。

<%@ Page Language="C#"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title> Calendar DayNameFormat Example </title>
</head>
<body>
   <form id="form1" runat="server">
  
     <h3> Calendar DayNameFormat Example </h3>

     <asp:Calendar id="Calendar1"
       daynameformat="Shortest"
       runat="server"/>
       
    </form>
  </body>
</html>
<%@ Page Language="VB"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title> Calendar DayNameFormat Example </title>
</head>
<body>
   <form id="form1" runat="server">
  
     <h3> Calendar DayNameFormat Example </h3>

     <asp:Calendar id="Calendar1"
       daynameformat="Shortest"
       runat="server"/>
       
    </form>
  </body>
</html>

備註

列舉 DayNameFormat 表示 控制項中 Calendar 星期幾的顯示格式。

注意

在某些文化特性中, DayNameFormat.FirstLetterDayNameFormat.FirstTwoLetter 顯示一或多個星期幾的相同值。 在這些文化特性中,請考慮使用 DayNameFormat.Shortest ,這會顯示可能的最短縮寫,而不需要使用相同的縮寫。

適用於

另請參閱