DetailsView.FieldHeaderStyle Proprietà

Definizione

Ottiene un riferimento all'oggetto TableItemStyle che consente di impostare l'aspetto della colonna dell'intestazione in un controllo DetailsView.

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

Valore della proprietà

Riferimento all'oggetto TableItemStyle che rappresenta lo stile della colonna dell'intestazione in un controllo DetailsView.

Attributi

Esempio

Nell'esempio di codice seguente viene illustrato come usare la FieldHeaderStyle proprietà per specificare le impostazioni del tipo di carattere e dello stile per la riga di intestazione del campo.


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

Commenti

Utilizzare la FieldHeaderStyle proprietà per controllare l'aspetto della colonna di intestazione del campo in un DetailsView controllo. Si tratta della colonna contenente i nomi dei campi dei valori dei dati. Questa proprietà è di sola lettura; tuttavia, è possibile impostare le proprietà dell'oggetto TableItemStyle restituito. Le proprietà possono essere impostate in modo dichiarativo nel formato Property-Subproperty, dove Subproperty è una proprietà dell'oggetto TableItemStyle , ad esempio FieldHeaderStyle-ForeColor. Le proprietà possono anche essere impostate a livello di codice nel modulo Property.Subproperty ( ad esempio , FieldHeaderStyle.ForeColor). Le impostazioni comuni in genere includono un colore di sfondo personalizzato, il colore di primo piano e le proprietà del carattere.

Si applica a

Vedi anche