FormView.FooterRow Propiedad

Definición

Obtiene el objeto FormViewRow que representa la fila del pie de página de un control FormView.

public:
 virtual property System::Web::UI::WebControls::FormViewRow ^ FooterRow { System::Web::UI::WebControls::FormViewRow ^ get(); };
[System.ComponentModel.Browsable(false)]
public virtual System.Web.UI.WebControls.FormViewRow FooterRow { get; }
[<System.ComponentModel.Browsable(false)>]
member this.FooterRow : System.Web.UI.WebControls.FormViewRow
Public Overridable ReadOnly Property FooterRow As FormViewRow

Valor de propiedad

Objeto FormViewRow que representa la fila de pie de página de un control FormView.

Atributos

Ejemplos

En el ejemplo siguiente se muestra cómo usar la FooterRow propiedad para modificar mediante programación las propiedades de la fila de pie de página durante el ItemCreated evento.


<%@ Page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  void EmployeeFormView_ItemCreated(Object sender, EventArgs e)
  {

    // Use the FooterRow property to retrieve the footer row.
    FormViewRow footer = EmployeeFormView.FooterRow;

    // Retrieve the FooterLabel Label control from the footer row. 
    Label footerLabel = (Label)footer.FindControl("FooterLabel");

    if(footerLabel != null)
    {
      // Display the current page number.
      int currentPage = EmployeeFormView.PageIndex + 1;
      footerLabel.Text = "Page " + currentPage.ToString();
    }

  }
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>FormView FooterTemplate Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView FooterTemplate Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true" 
        datakeynames="EmployeeID"
        onitemcreated="EmployeeFormView_ItemCreated"
        runat="server">
        
        <footertemplate>
          <table>
            <tr>
              <td>
                <asp:image id="LogoImage"
                  imageurl="~/Images/LogoImage.jpg"
                  alternatetext="Our Logo" 
                  runat="server"/>
              </td>
              <td>
                <asp:label id="FooterLabel"
                  runat="server"/>
              </td>
            </tr>
          </table>
        </footertemplate>
        
        <footerstyle horizontalalign="Center"
          forecolor="White"
          backcolor="LightBlue"/>
           
        <itemtemplate>
        
          <table>
            <tr>
              <td>
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td>
                <h3><%# Eval("FirstName") %> <%# Eval("LastName") %></h3>      
                <%# Eval("Title") %>        
              </td>
            </tr>
          </table>
        
        </itemtemplate>
          
        <pagersettings position="Bottom"
          mode="NextPrevious"/> 
                  
      </asp:formview>
          
      <!-- 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="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
        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">
<script runat="server">

  Sub EmployeeFormView_ItemCreated(ByVal sender As Object, ByVal e As EventArgs)

    ' Use the FooterRow property to retrieve the footer row.
    Dim footer As FormViewRow = EmployeeFormView.FooterRow

    ' Retrieve the FooterLabel Label control from the footer row. 
    Dim footerLabel As Label = CType(footer.FindControl("FooterLabel"), Label)

    If footerLabel IsNot Nothing Then
      
      ' Display the current page number.
      Dim currentPage As Integer = EmployeeFormView.PageIndex + 1
      footerLabel.Text = "Page " & currentPage.ToString()
    
    End If
  
  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>FormView FooterTemplate Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView FooterTemplate Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true" 
        datakeynames="EmployeeID"
        onitemcreated="EmployeeFormView_ItemCreated"
        runat="server">
        
        <footertemplate>
          <table>
            <tr>
              <td>
                <asp:image id="LogoImage"
                  imageurl="~/Images/LogoImage.jpg"
                  alternatetext="Our Logo" 
                  runat="server"/>
              </td>
              <td>
                <asp:label id="FooterLabel"
                  runat="server"/>
              </td>
            </tr>
          </table>
        </footertemplate>
        
        <footerstyle horizontalalign="Center"
          forecolor="White"
          backcolor="LightBlue"/>
           
        <itemtemplate>
        
          <table>
            <tr>
              <td>
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td>
                <h3><%# Eval("FirstName") %> <%# Eval("LastName") %></h3>      
                <%# Eval("Title") %>        
              </td>
            </tr>
          </table>
        
        </itemtemplate>
          
        <pagersettings position="Bottom"
          mode="NextPrevious"/> 
                  
      </asp:formview>
          
      <!-- 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="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
        runat="server"/>
            
    </form>
  </body>
</html>

Comentarios

La fila de pie de página se muestra en la parte inferior del FormView control cuando se establece la FooterText propiedad o FooterTemplate . Utilice la FooterRow propiedad para tener acceso mediante programación al FormViewRow objeto que representa la fila del pie de página.

Nota:

La FooterRow propiedad solo está disponible después de que el FormView control cree la fila de pie de página en el ItemCreated evento .

Esta propiedad se usa normalmente cuando es necesario manipular mediante programación la fila de pie de página, por ejemplo, al agregar contenido personalizado. Cualquier modificación de la FooterRow propiedad debe realizarse después de representar el FormView control; de lo contrario, el FormView control sobrescribe los cambios.

Para controlar el estilo de la fila de pie de página, utilice la FooterStyle propiedad .

Se aplica a

Consulte también