DetailsView.FieldHeaderStyle プロパティ

定義

TableItemStyle コントロールのヘッダー列の外観を設定できる 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

プロパティ値

TableItemStyle

TableItemStyle コントロールのヘッダー列のスタイルを表す DetailsView への参照。

属性

次のコード例では、プロパティを使用 FieldHeaderStyle してフィールド ヘッダー行のフォントとスタイルの設定を指定する方法を示します。


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

注釈

プロパティを FieldHeaderStyle 使用して、コントロール内のフィールド ヘッダー列の外観を DetailsView 制御します。 これは、データ値のフィールド名を含む列です。 このプロパティは読み取り専用です。ただし、返されるオブジェクトのプロパティを TableItemStyle 設定できます。 プロパティは、オブジェクトのプロパティ (たとえばFieldHeaderStyle-ForeColor) であるフォームProperty-Subproperty``Subpropertyで宣言的にTableItemStyle設定できます。 プロパティは、プログラムでフォームProperty.Subpropertyで設定することもできます (たとえば)。 FieldHeaderStyle.ForeColor 一般的な設定には、通常、カスタムの背景色、前景色、フォント プロパティが含まれます。

適用対象

こちらもご覧ください