DetailsView.HeaderText プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As DetailsView Dim value As String value = instance.HeaderText instance.HeaderText = value
[LocalizableAttribute(true)] public: virtual property String^ HeaderText { String^ get (); void set (String^ value); }
/** @property */ public String get_HeaderText () /** @property */ public void set_HeaderText (String value)
ヘッダー行に表示するテキスト。既定値は空の文字列 ("") です。この値は、このプロパティが設定されていないことを示します。

HeaderText プロパティまたは HeaderTemplate プロパティが設定されている場合、DetailsView コントロールの上部にヘッダー行が表示されます。HeaderText プロパティを使用して、ヘッダー行に表示するテキストを指定します。ヘッダー行のスタイルを制御するには、HeaderStyle プロパティを使用します。また、このプロパティの代わりに HeaderTemplate プロパティを設定して、ヘッダー行に独自のカスタム ユーザー インターフェイス (UI) を定義することもできます。
![]() |
---|
HeaderText プロパティと HeaderTemplate プロパティの両方が設定されている場合は、HeaderTemplate プロパティが優先されます。 |
このプロパティの値は、設定時に、デザイナ ツールを使用してリソース ファイルに自動的に保存できます。詳細については、LocalizableAttribute、ASP.NET のグローバリゼーションおよびローカリゼーション の各トピックを参照してください。

HeaderText プロパティを使用して、ヘッダー行に表示するテキストを指定する方法のコード例を次に示します。
<%@ Page language="VB" %> <html> <body> <form id="Form1" runat="server"> <h3>DetailsView HeaderText Example</h3> <asp:detailsview id="CustomerDetailView" datasourceid="DetailsViewSource" datakeynames="CustomerID" autogeneraterows="true" allowpaging="true" headertext="Confidential" runat="server"> <fieldheaderstyle backcolor="Navy" forecolor="White"/> <headerstyle forecolor="Red" backcolor="LightBlue" font-names="Arial" font-size="10" font-bold="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="C#" %> <html> <body> <form id="Form1" runat="server"> <h3>DetailsView HeaderText Example</h3> <asp:detailsview id="CustomerDetailView" datasourceid="DetailsViewSource" datakeynames="CustomerID" autogeneraterows="true" allowpaging="true" headertext="Confidential" runat="server"> <fieldheaderstyle backcolor="Navy" forecolor="White"/> <headerstyle forecolor="Red" backcolor="LightBlue" font-names="Arial" font-size="10" font-bold="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>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からDetailsView.HeaderText プロパティを検索する場合は、下記のリンクをクリックしてください。

- DetailsView.HeaderText プロパティのページへのリンク