FormView.BottomPagerRow Property
Gets the FormViewRow object that represents the pager row displayed at the bottom of the FormView control.
Assembly: System.Web (in System.Web.dll)
<BrowsableAttribute(False)> Public Overridable ReadOnly Property BottomPagerRow As FormViewRow
Property Value
Type: System.Web.UI.WebControls.FormViewRowA FormViewRow object that represents the bottom pager row of a FormView control.
When paging is enabled (when the AllowPaging property is set to true), an additional row called the pager row is automatically displayed in the FormView control. The pager row contains controls that allow the user to navigate to other records, and can be displayed at the top, the bottom, or both the top and bottom of the control. Use the BottomPagerRow property to programmatically access the FormViewRow object that represents the bottom pager row in the FormView control.
Note |
|---|
The BottomPagerRow property is available only after the FormView control creates the bottom pager row in the ItemCreated event. |
This property is commonly used when you need to programmatically manipulate the bottom pager row, for example when adding custom content. Any modification to the BottomPagerRow property must be performed after the FormViewRow object that represents the bottom pager row has been created; otherwise, the FormView control overwrites any changes.
The following example demonstrates how to use the BottomPagerRow property to access the pager row displayed at the bottom of a FormView control. The pager row is then updated with additional content.
<%@ 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_DataBound(ByVal sender As Object, ByVal e As EventArgs) ' Get the pager row. Dim pagerRow As FormViewRow = EmployeeFormView.BottomPagerRow ' Get the Label controls that display the current page information ' from the pager row. Dim pageNum As Label = CType(pagerRow.Cells(0).FindControl("PageNumberLabel"), Label) Dim totalNum As Label = CType(pagerRow.Cells(0).FindControl("TotalPagesLabel"), Label) If pageNum IsNot Nothing And totalNum IsNot Nothing Then ' Update the Label controls with the current page values. Dim page As Integer = EmployeeFormView.PageIndex + 1 Dim count As Integer = EmployeeFormView.PageCount pageNum.Text = page.ToString() totalNum.Text = count.ToString() End If End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>FormView PagerTemplate Example</title> </head> <body> <form id="form1" runat="server"> <h3>FormView PagerTemplate Example</h3> <asp:formview id="EmployeeFormView" datasourceid="EmployeeSource" allowpaging="true" datakeynames="EmployeeID" ondatabound="EmployeeFormView_DataBound" runat="server"> <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> <pagertemplate> <table width="100%"> <tr> <td> <asp:linkbutton id="PreviousButton" text="<" commandname="Page" commandargument="Prev" runat="Server"/> <asp:linkbutton id="NextButton" text=">" commandname="Page" commandargument="Next" runat="Server"/> </td> <td align="right"> Page <asp:label id="PageNumberLabel" runat="server"/> of <asp:label id="TotalPagesLabel" runat="server"/> </td> </tr> </table> </pagertemplate> <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>
Available since 2.0
