GridView.EditRowStyle 属性

获取对 TableItemStyle 对象的引用,使用该对象可以设置 GridView 控件中为进行编辑而选中的行的外观。

 

<%@ Page language="C#" %>

<html>
  <body>
    <form 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>

 

posted @ 2009-04-17 11:24  minmin8110  阅读(341)  评论(0)    收藏  举报