Calendar.TitleStyle Propiedad

Definición

Obtiene las propiedades de estilo del encabezado de título del control Calendar.

public:
 property System::Web::UI::WebControls::TableItemStyle ^ TitleStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.TableItemStyle TitleStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.TitleStyle : System.Web.UI.WebControls.TableItemStyle
Public ReadOnly Property TitleStyle As TableItemStyle

Valor de propiedad

TableItemStyle

Un objeto TableItemStyle que contiene las propiedades de estilo del encabezado de título del control Calendar. El valor predeterminado es un TableItemStyle vacío.

Atributos

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar la TitleStyle propiedad para especificar un color de fondo azul y un color de primer plano amarillo para el encabezado de título del Calendar control.

<%@ 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">

         <TitleStyle BackColor="Blue" ForeColor="Yellow">
         </TitleStyle>

      </asp:Calendar> 
           
   </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">

         <TitleStyle BackColor="Blue" ForeColor="Yellow">
         </TitleStyle>

      </asp:Calendar> 
           
   </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 background color for the title section of the Calendar.
         Calendar1.TitleStyle.BackColor = 
            System.Drawing.Color.FromName(ColorList.SelectedItem.Value);

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

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

      Select a background color for the title section of the calendar.

      <br /><br /> 
  
      <asp:Calendar id="Calendar1"
           ShowGridLines="True" 
           ShowTitle="True"
           runat="server"/>

      <br /><br />

      <table cellpadding="5">

         <tr>

            <td>

               Background color:

            </td>

         </tr>

         <tr>

            <td>

               <asp:DropDownList id="ColorList"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="Selection_Change"
                    runat="server">

                  <asp:ListItem Value="White"> White </asp:ListItem>
                  <asp:ListItem Selected="True" Value="Silver"> Silver </asp:ListItem>
                  <asp:ListItem Value="DarkGray"> Dark Gray </asp:ListItem>
                  <asp:ListItem Value="Khaki"> Khaki </asp:ListItem>
                  <asp:ListItem Value="DarkKhaki"> Dark Khaki </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 background color for title section of the Calendar.
         Calendar1.TitleStyle.BackColor = _
            System.Drawing.Color.FromName(ColorList.SelectedItem.Value)

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

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

      Select a background color for the title section of the calendar.

      <br /><br /> 
  
      <asp:Calendar id="Calendar1"
           ShowGridLines="True" 
           ShowTitle="True"
           runat="server"/>

      <br /><br />

      <table cellpadding="5">

         <tr>

            <td>

               Background color:

            </td>

         </tr>

         <tr>

            <td>

               <asp:DropDownList id="ColorList"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="Selection_Change"
                    runat="server">

                  <asp:ListItem Value="White"> White </asp:ListItem>
                  <asp:ListItem Selected="True" Value="Silver"> Silver </asp:ListItem>
                  <asp:ListItem Value="DarkGray"> Dark Gray </asp:ListItem>
                  <asp:ListItem Value="Khaki"> Khaki </asp:ListItem>
                  <asp:ListItem Value="DarkKhaki"> Dark Khaki </asp:ListItem>

               </asp:DropDownList>

            </td>

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

</body>
</html>

Comentarios

Utilice esta propiedad para especificar el estilo del encabezado de título del Calendar control. Para obtener más información sobre las diferentes propiedades de estilo que se pueden controlar, vea TableItemStyle.

La TitleStyle propiedad solo se aplica cuando la ShowTitle propiedad se establece trueen .

Se aplica a

Consulte también