DataControlField.HeaderStyle 속성

정의

데이터 컨트롤 필드의 머리글 스타일을 가져오거나 설정합니다.

public:
 property System::Web::UI::WebControls::TableItemStyle ^ HeaderStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.TableItemStyle HeaderStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.HeaderStyle : System.Web.UI.WebControls.TableItemStyle
Public ReadOnly Property HeaderStyle As TableItemStyle

속성 값

TableItemStyle

TableItemStyle의 머리글 항목 모양을 결정하는 DataControlField입니다.

특성

예제

다음 코드 예제에는 선언적으로 설정 하는 방법을 보여 줍니다.는 HeaderStyle 의 속성을 HyperLinkField 노란색 배경 색에서 열 머리글을 표시 하는 열은 GridView 컨트롤입니다.

<%@ page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="form1" 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="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="form1" 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>

설명

합니다 HeaderStyle 속성에서 파생 된 형식의 머리글 항목에 표시 되는 모든 텍스트의 모양을 결정 DataControlField합니다. 가장 일반적인 애플리케이션을 HeaderStyle 속성의 열 머리글의 스타일을 변경 하는 것을 GridView 제어 합니다.

적용 대상

추가 정보