GridView.EditRowStyle 속성

정의

TableItemStyle 컨트롤에서 편집하기 위해 선택한 행의 모양을 설정하는 데 사용할 수 있는 GridView 개체에 대한 참조를 가져옵니다.

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

속성 값

TableItemStyle

TableItemStyle 컨트롤에서 편집하고 있는 행의 스타일을 나타내는 GridView에 대한 참조입니다.

특성

예제

다음 예제에서는 컨트롤에서 편집 되는 행에 EditRowStyle 대 한 사용자 지정 스타일을 정의 하는 속성을 사용 하는 방법을 보여 줍니다 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>GridView EditRowStyle Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>GridView EditRowStyle Example</h3>

      <!-- The GridView control automatically sets the columns     -->
      <!-- specified in the datakeynames property as read-only.    -->
      <!-- No input controls are rendered for these columns in     -->
      <!-- edit mode.                                              -->
      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="true"
        autogeneratedeletebutton="true"
        autogenerateeditbutton="true"
        datakeynames="CustomerID"  
        runat="server">
        
        <editrowstyle backcolor="LightCyan"
          forecolor="DarkBlue"/>
                    
      </asp:gridview>
            
      <!-- 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="CustomersSqlDataSource"  
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
        updatecommand="Update Customers SET CompanyName=@CompanyName, Address=@Address, City=@City, PostalCode=@PostalCode, Country=@Country WHERE (CustomerID = @CustomerID)"
        deletecommand="Delete from Customers where CustomerID = @CustomerID"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
        runat="server">
      </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>GridView EditRowStyle Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>GridView EditRowStyle Example</h3>

      <!-- The GridView control automatically sets the columns     -->
      <!-- specified in the datakeynames property as read-only.    -->
      <!-- No input controls are rendered for these columns in     -->
      <!-- edit mode.                                              -->
      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="true"
        autogeneratedeletebutton="true"
        autogenerateeditbutton="true"
        datakeynames="CustomerID"  
        runat="server">
        
        <editrowstyle backcolor="LightCyan"
          forecolor="DarkBlue"/>
                    
      </asp:gridview>
            
      <!-- 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="CustomersSqlDataSource"  
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
        updatecommand="Update Customers SET CompanyName=@CompanyName, Address=@Address, City=@City, PostalCode=@PostalCode, Country=@Country WHERE (CustomerID = @CustomerID)"
        deletecommand="Delete from Customers where CustomerID = @CustomerID"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>

설명

컨트롤에서 EditRowStyle 편집 GridView 할 행의 모양을 제어하려면 이 속성을 사용합니다. 이 속성은 읽기 전용입니다. 그러나의 속성을 설정할 수는 TableItemStyle 개체를 반환 합니다. 속성은 다음 메서드 중 하나를 사용하여 선언적으로 설정할 수 있습니다.

  • 개체의 속성(예EditRowStyle-ForeColor: )인 폼 Subproperty Property-Subproperty에서 컨트롤의 GridView 여는 태그에 TableItemStyle 특성을 배치합니다.

  • <EditRowStyle> 컨트롤의 여는 태그와 닫는 태그 사이에 요소를 중 GridView 첩합니다.

형식에서 속성을 프로그래밍 방식으로 설정할 수도 있습니다 Property.Subproperty (예를 들어 EditRowStyle.ForeColor). 일반적인 설정에는 일반적으로 사용자 지정 배경색, 전경색 및 글꼴 속성이 포함됩니다.

적용 대상

추가 정보