DetailsView.EditRowStyle Свойство

Определение

Возвращает ссылку на объект TableItemStyle, позволяющий задать внешний вид строк данных во время пребывания элемента управления DetailsView в режиме редактирования.

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, представляющий стиль строк данных во время пребывания элемента управления DetailsView в режиме редактирования.

Атрибуты

Примеры

В следующем примере кода показано, как использовать EditRowStyle свойство для указания параметров шрифта и стиля для строк данных, когда DetailsView элемент управления находится в режиме редактирования.


<%@ 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>DetailsView EditRowStyle Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView EditRowStyle Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogenerateeditbutton="true"  
          autogeneraterows="true"
          allowpaging="true"  
          runat="server">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
            
          <editrowstyle backcolor="LightCyan"
            forecolor="Blue"
            font-names="Arial" />
                    
        </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="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>DetailsView EditRowStyle Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView EditRowStyle Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogenerateeditbutton="true"  
          autogeneraterows="true"
          allowpaging="true"  
          runat="server">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
            
          <editrowstyle backcolor="LightCyan"
            forecolor="Blue"
            font-names="Arial" />
                    
        </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>

Комментарии

Используйте свойство для EditRowStyle управления внешним видом строк данных, когда DetailsView элемент управления находится в режиме редактирования. Это свойство доступно только для чтения; однако можно задать свойства возвращаемого TableItemStyle объекта. Свойства можно задать декларативно в форме Property-Subproperty, где Subproperty — это свойство TableItemStyle объекта (например, EditRowStyle-ForeColor). Свойства также можно задать программным способом в форме Property.Subproperty (например, EditRowStyle.ForeColor). Общие параметры обычно включают настраиваемый цвет фона, цвет переднего плана и свойства шрифта.

Применяется к

См. также раздел