GridView.FooterStyle Свойство

Определение

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

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

Значение свойства

Ссылка на TableItemStyle, представляющий стиль строки нижнего колонтитула в элементе управления GridView.

Атрибуты

Примеры

В следующем примере показано, как использовать FooterStyle свойство для определения пользовательского стиля для строки нижнего колонтитула в элементе 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 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>

Комментарии

Используйте свойство для FooterStyle управления внешним видом строки нижнего колонтитула в элементе GridView управления . Это свойство доступно только для чтения; однако можно задать свойства возвращаемого TableItemStyle объекта. Свойства можно задать декларативно с помощью одного из следующих методов:

  • Поместите атрибут в открывающий тег GridView элемента управления в форме Property-Subproperty, где Subproperty является свойством TableItemStyle объекта (например, FooterStyle-ForeColor).

  • Вложение <FooterStyle> элемента между открывающим и закрывающим тегами GridView элемента управления.

Свойства также можно задать программным способом в форме Property.Subproperty (например, FooterStyle.ForeColor). Общие параметры обычно включают пользовательский цвет фона, цвет переднего плана и свойства шрифта.

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

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