DetailsView.FooterText 属性

定义

获取或设置要在 DetailsView 控件的脚注行中显示的文本。Gets or sets the text to display in the footer row of a DetailsView control.

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

属性值

脚注行中将显示的文本。The text to display in the footer row. 默认值为空字符串 (""),表示尚未设置此属性。The default is an empty string (""), which indicates that this property is not set.

示例

下面的代码示例演示如何使用FooterText属性指定要在脚注行中显示的文本。The following code example demonstrates how to use the FooterText property to specify the text to display in the footer row.


<%@ 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>

注解

设置DetailsView FooterText或属性FooterTemplate时, 在控件的底部显示脚注行。The footer row is displayed at the bottom of the DetailsView control when the FooterText or FooterTemplate property is set. FooterText使用属性指定要在脚注行中显示的文本。Use the FooterText property to specify the text to display in the footer row. 若要控制脚注行的样式, 请使用FooterStyle属性。To control the style of the footer row, use the FooterStyle property. 或者, 您可以通过设置FooterTemplate属性而不是此属性, 为页脚行定义您自己的自定义用户界面 (UI)。Alternatively, you can define your own custom user interface (UI) for the footer row by setting the FooterTemplate property instead of this property.

备注

如果同时设置FooterTextFooterTemplate和属性, 则FooterTemplate属性优先。If both the FooterText and FooterTemplate properties are set, the FooterTemplate property takes precedence.

的值FooterText存储在视图状态中。The value of FooterText is stored in view state.

设置此属性后, 可以使用设计器工具自动将此属性的值保存到资源文件中。The value of this property, when set, can be saved automatically to a resource file by using a designer tool. 有关详细信息, 请LocalizableAttribute参阅和全球化和本地化For more information, see LocalizableAttribute and Globalization and Localization.

适用于

另请参阅