DataControlField.ControlStyle 속성

정의

DataControlField 개체에 포함된 웹 서버 컨트롤의 스타일을 가져옵니다.

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

속성 값

Style

필드에 포함된 웹 서버 컨트롤의 모양을 제어하는 Style입니다.

특성

예제

다음 코드 예제에 사용 하는 방법을 보여 줍니다. BoundField 하 고 ButtonField 개체에서 파생 되는 DataControlField에서 행을 표시 하는 DetailsView 컨트롤입니다. ControlStyle 의 속성을 ButtonField 개체에 설정 되 고 제어 하는 방법을 LinkButton 필드에 포함 된 컨트롤에 표시 됩니다.

<%@ 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:detailsview
      id="DetailsView1"
      runat="server"
      allowpaging="True"
      datasourceid="SqlDataSource1"
      autogeneraterows="False"
      width="312px"
      height="152px">
        <fields>
          <asp:boundfield
            visible="False"
            sortexpression="EmployeeID"
            datafield="EmployeeID">
          </asp:boundfield>

          <asp:boundfield
            sortexpression="LastName"
            datafield="LastName"
            headertext="LastName">
          </asp:boundfield>

          <asp:boundfield
            sortexpression="FirstName"
            datafield="FirstName"
            headertext="FirstName">
          </asp:boundfield>

          <asp:boundfield
            sortexpression="Title"
            datafield="Title"
            headertext="Title">
          </asp:boundfield>

          <asp:buttonfield text="Button">
            <controlstyle font-bold="True" forecolor="Red" />
          </asp:buttonfield>
        </fields>
    </asp:detailsview>

    <asp:sqldatasource
      id="SqlDataSource1"
      runat="server"
      selectcommand="SELECT * FROM Employees"
      connectionstring="<%$ ConnectionStrings:MyNorthwind%>">
    </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">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="form1" runat="server">
    <asp:detailsview
      id="DetailsView1"
      runat="server"
      allowpaging="True"
      datasourceid="SqlDataSource1"
      autogeneraterows="False"
      width="312px"
      height="152px">
        <fields>
          <asp:boundfield
            visible="False"
            sortexpression="EmployeeID"
            datafield="EmployeeID">
          </asp:boundfield>

          <asp:boundfield
            sortexpression="LastName"
            datafield="LastName"
            headertext="LastName">
          </asp:boundfield>

          <asp:boundfield
            sortexpression="FirstName"
            datafield="FirstName"
            headertext="FirstName">
          </asp:boundfield>

          <asp:boundfield
            sortexpression="Title"
            datafield="Title"
            headertext="Title">
          </asp:boundfield>

          <asp:buttonfield text="Button">
            <controlstyle font-bold="True" forecolor="Red" />
          </asp:buttonfield>
        </fields>
    </asp:detailsview>

    <asp:sqldatasource
      id="SqlDataSource1"
      runat="server"
      selectcommand="SELECT * FROM Employees"
      connectionstring="<%$ ConnectionStrings:MyNorthwind%>">
    </asp:sqldatasource>

  </form>
</body>
</html>

설명

합니다 ControlStyle 속성에서 파생 된 형식에 포함 된 모든 웹 서버 컨트롤의 모양을 결정 DataControlField합니다.

이 속성 모든 파생된 형식에 영향을 주지 않습니다. BoundField 일반적으로 텍스트 데이터를 표시 하 고만 들어 있는 컨트롤 TextBox 제어, 영향을 줍니다 합니다 ControlStyle 속성에 있는 경우 Edit 상태입니다. 같은 웹 서버 컨트롤 ButtonField 하 고 CheckBoxField 영향을 받을 수는 ControlStyle 필드에 포함 된 컨트롤 개체 인스턴스 특정 구성에 따라 속성. 예를 들어 합니다 ButtonField 컨트롤 렌더링 될 수 있습니다를 LinkButton, ImageButton, 또는 Button 개체입니다. 하지만 LinkButton 컨트롤은 영향을 받지 font 지정 된 특성 Style 개체를 Button 컨트롤이 아닙니다.

적용 대상

추가 정보