DetailsView.FooterText 屬性

定義

取得或設定顯示於 DetailsView 控制項頁尾資料列的文字。

public:
 virtual property System::String ^ FooterText { System::String ^ get(); void set(System::String ^ value); };
public virtual string FooterText { get; set; }
member this.FooterText : string with get, set
Public Overridable Property FooterText As String

屬性值

頁尾資料列中所要顯示的文字。 預設為空字串 (""),表示這個屬性未設定。

範例

下列程式碼範例示範如何使用 FooterText 屬性來指定要顯示在頁尾資料列中的文字。


<%@ 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 FooterText Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView FooterText Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogeneraterows="true"
          allowpaging="true"
          footertext="Confidential"   
          runat="server">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
            
          <footerstyle forecolor="Red"
            backcolor="LightBlue" 
            font-names="Arial"
            font-size="10"
            font-bold="true"/>
                    
        </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 FooterText Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView FooterText Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogeneraterows="true"
          allowpaging="true"
          footertext="Confidential"   
          runat="server">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
            
          <footerstyle forecolor="Red"
            backcolor="LightBlue" 
            font-names="Arial"
            font-size="10"
            font-bold="true"/>
                    
        </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>

備註

設定 或 FooterTemplate 屬性時 FooterText ,頁尾列會顯示在控制項底部 DetailsViewFooterText使用 屬性來指定要顯示在頁尾資料列中的文字。 若要控制頁尾資料列的樣式,請使用 FooterStyle 屬性。 或者,您可以藉由設定 FooterTemplate 屬性而非此屬性,定義自己的自訂使用者介面 (UI) 。

注意

如果同時 FooterText 設定 和 FooterTemplate 屬性,則 FooterTemplate 屬性會優先使用。

的值 FooterText 會儲存在檢視狀態中。

設定時,這個屬性的值可以使用設計工具自動儲存到資源檔。 如需詳細資訊,請參閱 LocalizableAttribute全球化和當地語系化

適用於

另請參閱