GridView.HeaderStyle Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Bir denetimdeki TableItemStyle üst bilgi satırının görünümünü ayarlamanıza olanak tanıyan nesneye başvuru GridView alır.
public:
property System::Web::UI::WebControls::TableItemStyle ^ HeaderStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.TableItemStyle HeaderStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.HeaderStyle : System.Web.UI.WebControls.TableItemStyle
Public ReadOnly Property HeaderStyle As TableItemStyle
Özellik Değeri
Denetimdeki TableItemStyle üst bilgi satırının stilini temsil eden öğesine başvuru GridView .
- Öznitelikler
Örnekler
Aşağıdaki örnek, bir denetimdeki HeaderStyle üst bilgi satırı GridView için özel bir stil tanımlamak ü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>GridView ShowHeader and ShowFooter Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>GridView ShowHeader and ShowFooter Example</h3>
<asp:gridview id="CustomersGridView"
datasourceid="CustomersSource"
autogeneratecolumns="true"
emptydatatext="No data available."
showheader="true"
showfooter="true"
runat="server">
<headerstyle backcolor="LightCyan"
forecolor="MediumBlue"/>
<footerstyle backcolor="LightCyan"
forecolor="MediumBlue"/>
</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="CustomersSource"
selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>
</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 ShowHeader and ShowFooter Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>GridView ShowHeader and ShowFooter Example</h3>
<asp:gridview id="CustomersGridView"
datasourceid="CustomersSource"
autogeneratecolumns="true"
emptydatatext="No data available."
showheader="true"
showfooter="true"
runat="server">
<headerstyle backcolor="LightCyan"
forecolor="MediumBlue"/>
<footerstyle backcolor="LightCyan"
forecolor="MediumBlue"/>
</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="CustomersSource"
selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>
</form>
</body>
</html>
Açıklamalar
Bir denetimdeki HeaderStyle üst bilgi satırının GridView görünümünü denetlemek için özelliğini kullanın. Bu özellik salt okunurdur; ancak, döndürdüğü nesnenin TableItemStyle özelliklerini ayarlayabilirsiniz. Özellikler, aşağıdaki yöntemlerden biri kullanılarak bildirim temelli olarak ayarlanabilir:
Bir özniteliği, denetimin açma etiketine GridView biçiminde
Property-Subproperty
yerleştirin; buradaSubproperty
nesnenin TableItemStyle bir özelliğidir (örneğin,HeaderStyle-ForeColor
).Bir
<HeaderStyle>
öğeyi denetimin açma ve kapatma etiketleri arasında iç içe yerleştirme GridView .
Özellikler, biçiminde Property.Subproperty
program aracılığıyla da ayarlanabilir (örneğin, HeaderStyle.ForeColor
). Genel ayarlar genellikle özel bir arka plan rengi, ön plan rengi ve yazı tipi özelliklerini içerir.