Calendar.NextPrevFormat Propriété

Définition

Obtient ou définit le format des éléments de navigation vers les mois précédents et suivants dans la section de titre du contrôle Calendar.

public:
 property System::Web::UI::WebControls::NextPrevFormat NextPrevFormat { System::Web::UI::WebControls::NextPrevFormat get(); void set(System::Web::UI::WebControls::NextPrevFormat value); };
[System.ComponentModel.Bindable(true)]
public System.Web.UI.WebControls.NextPrevFormat NextPrevFormat { get; set; }
public System.Web.UI.WebControls.NextPrevFormat NextPrevFormat { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.NextPrevFormat : System.Web.UI.WebControls.NextPrevFormat with get, set
member this.NextPrevFormat : System.Web.UI.WebControls.NextPrevFormat with get, set
Public Property NextPrevFormat As NextPrevFormat

Valeur de propriété

Une des valeurs de l'objet NextPrevFormat. La valeur par défaut est CustomText.

Attributs

Exceptions

Le format spécifié n'est pas l'une des valeurs NextPrevFormat.

Exemples

L’exemple de code suivant montre comment utiliser la NextPrevFormat propriété pour spécifier le format de mois court pour les contrôles de navigation.

<%@ Page Language="C#" AutoEventWireup="True" %>
<!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>
    <title>Calendar Example</title>
</head>
<body>

   <form id="form1" runat="server">

      <h3>Calendar Example</h3>

      <asp:Calendar id="calendar1" runat="server"
           ShowNextPrevMonth="true"
           NextPrevFormat="ShortMonth"/>
            
   </form>
        

</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<!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>
    <title>Calendar Example</title>
</head>
<body>

   <form id="form1" runat="server">

      <h3>Calendar Example</h3>

      <asp:Calendar id="calendar1" runat="server"
           ShowNextPrevMonth="True"
           NextPrevFormat="ShortMonth"/>
            
   </form>
        

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

<!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" >
   <script runat="server" >
  
      void Selection_Change(Object sender, EventArgs e)
      {

         // Set the format for the next and previous month controls.
         Calendar1.NextPrevFormat = (NextPrevFormat)DayList.SelectedIndex;

      }
  
   </script>
  
<head runat="server">
    <title> Calendar NextPrevFormat Example </title>
</head>
<body>

   <form id="form1" runat="server">
  
      <h3> Calendar NextPrevFormat Example </h3>

      Select a format for the next and previous month controls.

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

                  <asp:ListItem Selected="True"> Custom </asp:ListItem>
                  <asp:ListItem> ShortMonth </asp:ListItem>
                  <asp:ListItem> FullMonth </asp:ListItem>

               </asp:DropDownList>

            </td>

         </tr>
  
      </table>
  
   </form>

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

<!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" >
   <script runat="server" >
  
      Sub Selection_Change(sender As Object, e As EventArgs)

         ' Set the format for the next and previous month controls.
         Calendar1.NextPrevFormat = _
            CType(DayList.SelectedIndex, NextPrevFormat)

      End Sub
  
   </script>
  
<head runat="server">
    <title> Calendar NextPrevFormat Example </title>
</head>
<body>

   <form id="form1" runat="server">
  
      <h3> Calendar NextPrevFormat Example </h3>

      Select a format for the next and previous month controls.

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

                  <asp:ListItem Selected="True"> Custom </asp:ListItem>
                  <asp:ListItem> ShortMonth </asp:ListItem>
                  <asp:ListItem> FullMonth </asp:ListItem>

               </asp:DropDownList>

            </td>

         </tr>
      
      </table>
      
   </form>

</body>
</html>

Remarques

Utilisez la NextPrevFormat propriété pour spécifier le format des éléments de navigation du mois suivant et du mois précédent sur le Calendar contrôle. Cette propriété est définie avec l’une des valeurs d’énumération NextPrevFormat . Vous pouvez spécifier si le texte des contrôles de navigation s’affiche sous la forme du nom complet du mois, du nom court (abrégé) du mois ou du texte personnalisé.

Pour spécifier un texte de navigation personnalisé, définissez cette propriété sur NextPrevFormat.CustomText et définissez les NextMonthText propriétés et PrevMonthText sur le texte personnalisé.

Cette propriété s’applique uniquement si la ShowNextPrevMonth propriété a la truevaleur .

S’applique à

Voir aussi