Bagikan melalui


DetailsView.FieldHeaderStyle Properti

Definisi

Mendapatkan referensi ke TableItemStyle objek yang memungkinkan Anda mengatur tampilan kolom header dalam DetailsView kontrol.

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

Nilai Properti

Referensi ke TableItemStyle yang mewakili gaya kolom header dalam DetailsView kontrol.

Atribut

Contoh

Contoh kode berikut menunjukkan cara menggunakan FieldHeaderStyle properti untuk menentukan pengaturan font dan gaya untuk baris header bidang.


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

Keterangan

FieldHeaderStyle Gunakan properti untuk mengontrol tampilan kolom header bidang dalam DetailsView kontrol. Ini adalah kolom yang berisi nama bidang nilai data. Properti ini bersifat baca-saja; namun, Anda dapat mengatur properti objek yang TableItemStyle dikembalikannya. Properti dapat diatur secara deklaratif dalam formulir Property-Subproperty, di mana Subproperty adalah properti objek TableItemStyle (misalnya, FieldHeaderStyle-ForeColor). Properti juga dapat diatur secara terprogram dalam formulir Property.Subproperty (misalnya, FieldHeaderStyle.ForeColor). Pengaturan umum biasanya mencakup warna latar belakang kustom, warna latar depan, dan properti font.

Berlaku untuk

Lihat juga