Aracılığıyla paylaş


DetailsView.RowStyle Özellik

Tanım

Bir denetimdeki TableItemStyle veri satırlarının görünümünü ayarlamanıza olanak tanıyan nesneye başvuru DetailsView alır.

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

Özellik Değeri

Bir denetimdeki TableItemStyle veri satırlarının stilini temsil eden öğesine DetailsView başvuru.

Öznitelikler

Örnekler

Aşağıdaki kod örneği, denetimindeki RowStyle veri satırları DetailsView için yazı tipi ve stil ayarlarını belirtmek üzere özelliğinin nasıl kullanılacağını gösterir.

<%@ 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 RowStyle and AlternatingRowStyle Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView RowStyle and AlternatingRowStyle Example</h3>
                
        <asp:detailsview id="CustomersView"
          datasourceid="Customers"
          autogeneraterows="true"
          allowpaging="true" 
          runat="server">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
            
          <RowStyle BackColor="LightGray"
            ForeColor="Blue"
            Font-Names="Arial"
            Font-Size="10"
            Font-Italic="true"/>
            
          <AlternatingRowStyle BackColor="White"
            ForeColor="Blue"
            Font-Names="Arial"
            Font-Size="10"
            Font-Italic="true"/>
                    
        </asp:detailsview>
            
        <!-- This example uses Microsoft SQL Server and connects -->
        <!-- to the Northwind sample database. -->           
        <asp:SqlDataSource ID="Customers" runat="server" 
          ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
          SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID], [Phone] 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 RowStyle and AlternatingRowStyle Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView RowStyle and AlternatingRowStyle Example</h3>
                
        <asp:detailsview id="CustomersView"
          datasourceid="Customers"
          autogeneraterows="true"
          allowpaging="true" 
          runat="server">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
            
          <RowStyle BackColor="LightGray"
            ForeColor="Blue"
            Font-Names="Arial"
            Font-Size="10"
            Font-Italic="true"/>
            
          <AlternatingRowStyle BackColor="White"
            ForeColor="Blue"
            Font-Names="Arial"
            Font-Size="10"
            Font-Italic="true"/>
                    
        </asp:detailsview>
            
        <!-- This example uses Microsoft SQL Server and connects -->
        <!-- to the Northwind sample database. -->           
        <asp:SqlDataSource ID="Customers" runat="server" 
          ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
          SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID], [Phone] FROM [Customers]">
        </asp:SqlDataSource>
            
      </form>
  </body>
</html>

Açıklamalar

Bir denetimdeki RowStyle veri satırlarının DetailsView görünümünü denetlemek için özelliğini kullanın. AlternatingRowStyle Özellik de ayarlandığında, veri satırları ayarlar ve AlternatingRowStyle ayarlar arasında RowStyle değişen olarak görüntülenir. Bu özellik salt okunurdur; ancak, döndürdüğü nesnenin TableItemStyle özelliklerini ayarlayabilirsiniz. Özellikler biçiminde Property-Subpropertybildirimli olarak ayarlanabilir; burada Subproperty nesnenin TableItemStyle bir özelliğidir (örneğin, RowStyle-ForeColor). Özellikler, formda Property.Subproperty program aracılığıyla da ayarlanabilir (örneğin, RowStyle.ForeColor). Yaygın ayarlar genellikle özel bir arka plan rengi, ön plan rengi ve yazı tipi özellikleri içerir.

Şunlara uygulanır

Ayrıca bkz.