다음을 통해 공유


FormView.FooterRow 속성

정의

FormViewRow 컨트롤의 바닥글 행을 나타내는 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

속성 값

FormViewRow 컨트롤의 바닥글 행을 나타내는 FormView입니다.

특성

예제

다음 예제에서는 사용 FooterRow 하는 방법에 설명 합니다 속성을 프로그래밍 방식으로 수정 하는 동안 바닥글 행 ItemCreated 의 속성 이벤트입니다.


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

설명

바닥글 행은 또는 FooterTemplate 속성이 설정될 때 FooterText 컨트롤의 FormView 맨 아래에 표시됩니다. 사용 된 FooterRow 속성을 프로그래밍 방식으로 바닥글 행을 FormViewRow 나타내는 개체에 액세스 합니다.

참고

속성은 FooterRow 컨트롤이 FormView 이벤트에 바닥글 행을 만든 후에만 사용할 수 있습니다 ItemCreated .

이 속성은 사용자 지정 콘텐츠를 추가할 때와 같이 바닥글 행을 프로그래밍 방식으로 조작해야 하는 경우에 일반적으로 사용됩니다. 컨트롤이 FooterRow 렌더링된 후 FormView 속성을 수정해야 합니다. 그렇지 않으면 컨트롤이 FormView 변경 내용을 덮어씁니다.

바닥글 행의 스타일을 제어하려면 속성을 사용합니다 FooterStyle .

적용 대상

추가 정보