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

DataControlField ヘッダー項目の外観を制御する TableItemStyle。

HeaderStyle プロパティは、DataControlField から派生した型のヘッダー項目に表示されるすべてのテキストの外観を制御します。HeaderStyle プロパティは、通常、GridView コントロールの列ヘッダーのスタイルを変更する場合に使用します。

GridView コントロールの列ヘッダーに黄色の背景色を表示する HyperLinkField 列の HeaderStyle プロパティを、宣言によって設定する方法を次のコード例に示します。
<%@ page language="VB" %> <html> <body> <form runat="server"> <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:MyNorthwind%>" selectcommand="SELECT EmployeeID, FirstName, LastName, Title, Region FROM Employees"> </asp:sqldatasource> <asp:gridview id="GridView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" allowsorting="True" width="472px"> <columns> <asp:buttonfield headerimageurl="http://www.microsoft.com/homepage/gif/bnr-microsoft.gif" text="ClickMe" showheader="True" buttontype="Button"> </asp:buttonfield> <asp:hyperlinkfield target="http://msdn.microsoft.com/" headertext="Link To Info" text="MyLink"> <headerstyle backcolor="Yellow"> </headerstyle> </asp:hyperlinkfield> </columns> </asp:gridview> </form> </body> </html>
<%@ page language="C#" %> <html> <body> <form runat="server"> <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:MyNorthwind%>" selectcommand="SELECT EmployeeID, FirstName, LastName, Title, Region FROM Employees"> </asp:sqldatasource> <asp:gridview id="GridView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" allowsorting="True" width="472px"> <columns> <asp:buttonfield headerimageurl="http://www.microsoft.com/homepage/gif/bnr-microsoft.gif" text="ClickMe" showheader="True" buttontype="Button"> </asp:buttonfield> <asp:hyperlinkfield target="http://msdn.microsoft.com/" headertext="Link To Info" text="MyLink"> <headerstyle backcolor="Yellow"> </headerstyle> </asp:hyperlinkfield> </columns> </asp:gridview> </form> </body> </html>
<%@ page language="VJ#" %> <html> <body> <form runat="server"> <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind" selectcommand="Select EmployeeID, FirstName, LastName, Title, Region From Employees"> </asp:sqldatasource> <asp:gridview id="GridView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" allowsorting="True" width="472px"> <columns> <asp:buttonfield headerimageurl="http://www.microsoft.com/homepage/gif/bnr-microsoft.gif" text="ClickMe" showheader="True" buttontype="Button"> </asp:buttonfield> <asp:hyperlinkfield target="http://msdn.microsoft.com/" headertext="Link To Info" text="MyLink"> <headerstyle backcolor="Yellow"> </headerstyle> </asp:hyperlinkfield> </columns> </asp:gridview> </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に収録されているすべての辞書からDataControlField.HeaderStyle プロパティを検索する場合は、下記のリンクをクリックしてください。

- DataControlField.HeaderStyle プロパティのページへのリンク