Calendar.NextPrevFormat Propiedad

Definición

Obtiene o establece el formato de los elementos de navegación de mes siguiente y mes anterior en la sección de título del control Calendar.

C#
[System.ComponentModel.Bindable(true)]
public System.Web.UI.WebControls.NextPrevFormat NextPrevFormat { get; set; }
C#
public System.Web.UI.WebControls.NextPrevFormat NextPrevFormat { get; set; }

Valor de propiedad

Uno de los valores de NextPrevFormat. El valor predeterminado es CustomText.

Atributos

Excepciones

El formato especificado no es ninguno de los valores de NextPrevFormat.

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar la NextPrevFormat propiedad para especificar el formato de mes corto para los controles de navegación.

ASP.NET (C#)
<%@ 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>
ASP.NET (C#)
<%@ 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>

Comentarios

Utilice la NextPrevFormat propiedad para especificar el formato de los elementos de navegación del mes siguiente y anterior en el Calendar control . Esta propiedad se establece con uno de los NextPrevFormat valores de enumeración. Puede especificar si el texto de los controles de navegación se muestra como el nombre completo del mes, el nombre del mes corto (abreviado) o el texto personalizado.

Para especificar texto de navegación personalizado, establezca esta propiedad NextPrevFormat.CustomText en y establezca las NextMonthText propiedades y PrevMonthText en el texto personalizado.

Esta propiedad solo se aplica si la ShowNextPrevMonth propiedad está establecida en true.

Se aplica a

Produto Versións
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Consulte también