DetailsView.FieldHeaderStyle Propriedade

Definição

Obtém uma referência ao objeto TableItemStyle que permite a você definir a aparência da coluna de cabeçalho em um controle DetailsView.Gets a reference to the TableItemStyle object that allows you to set the appearance of the header column in a DetailsView control.

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

Valor da propriedade

TableItemStyle

Uma referência ao TableItemStyle que representa o estilo da coluna de cabeçalho em um DetailsView controle.A reference to the TableItemStyle that represents the style of the header column in a DetailsView control.

Atributos

Exemplos

O exemplo de código a seguir demonstra como usar a FieldHeaderStyle propriedade para especificar as configurações de fonte e estilo para a linha de cabeçalho de campo.The following code example demonstrates how to use the FieldHeaderStyle property to specify the font and style settings for the field header row.


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

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

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>DetailsView FontHeaderStyle Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView FontHeaderStyle Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogeneraterows="true"
          allowpaging="true"
          runat="server">
               
          <fieldheaderstyle backcolor="Navy"
            forecolor="White"
            Font-Bold="true"
            Font-Italic="true"
            />
                    
        </asp:detailsview>
        
        <!-- This example uses Microsoft SQL Server and connects  -->
        <!-- to the Northwind sample database. Use an ASP.NET     -->
        <!-- expression to retrieve the connection string value   -->
        <!-- from the web.config file.                            -->
        <asp:SqlDataSource ID="DetailsViewSource" runat="server" ConnectionString="<%$ ConnectionStrings:NorthWindConnectionString%>"
            InsertCommand="INSERT INTO [Customers]([CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country]) VALUES (@CustomerID, @CompanyName, @Address, @City, @PostalCode, @Country)"
            SelectCommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]">
        </asp:SqlDataSource>
    </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">
<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>DetailsView FontHeaderStyle Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView FontHeaderStyle Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogeneraterows="true"
          allowpaging="true"
          runat="server">
               
          <fieldheaderstyle backcolor="Navy"
            forecolor="White"
            Font-Bold="true"
            Font-Italic="true"
            />
                    
        </asp:detailsview>
        
        <!-- This example uses Microsoft SQL Server and connects  -->
        <!-- to the Northwind sample database. Use an ASP.NET     -->
        <!-- expression to retrieve the connection string value   -->
        <!-- from the web.config file.                            -->
        <asp:SqlDataSource ID="DetailsViewSource" runat="server" ConnectionString="<%$ ConnectionStrings:NorthWindConnectionString%>"
            InsertCommand="INSERT INTO [Customers]([CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country]) VALUES (@CustomerID, @CompanyName, @Address, @City, @PostalCode, @Country)"
            SelectCommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]">
        </asp:SqlDataSource>
    </form>
  </body>
</html>

Comentários

Use a FieldHeaderStyle propriedade para controlar a aparência da coluna de cabeçalho de campo em um DetailsView controle.Use the FieldHeaderStyle property to control the appearance of the field header column in a DetailsView control. Essa é a coluna que contém os nomes de campo dos valores de dados.This is the column that contains the field names of the data values. Esta propriedade é somente leitura; no entanto, você pode definir as propriedades do TableItemStyle objeto retornado.This property is read-only; however, you can set the properties of the TableItemStyle object it returns. As propriedades podem ser definidas declarativamente no formulário Property-Subproperty , em que Subproperty é uma propriedade do TableItemStyle objeto (por exemplo, FieldHeaderStyle-ForeColor ).The properties can be set declaratively in the form Property-Subproperty, where Subproperty is a property of the TableItemStyle object (for example, FieldHeaderStyle-ForeColor). As propriedades também podem ser definidas programaticamente no formulário Property.Subproperty (por exemplo, FieldHeaderStyle.ForeColor ).The properties can also be set programmatically in the form Property.Subproperty (for example, FieldHeaderStyle.ForeColor). As configurações comuns geralmente incluem uma cor de fundo personalizada, cor de primeiro plano e propriedades de fonte.Common settings usually include a custom background color, foreground color, and font properties.

Aplica-se a

Confira também