FormView.BottomPagerRow プロパティ
アセンブリ: System.Web (system.web.dll 内)

FormView コントロールの下部のページ行を表す FormViewRow オブジェクト。

ページングが有効になっている場合 (AllowPaging プロパティが true に設定されている場合)、ページ行と呼ばれる追加行が自動的に FormView コントロールに表示されます。ページ行にはユーザーが他のレコードに移動できるコントロールが含まれ、コントロールの上部、下部、または上部と下部の両方に表示できます。FormView コントロールの下部のページ行を表す FormViewRow オブジェクトにプログラムでアクセスするには、BottomPagerRow プロパティを使用します。
![]() |
---|
BottomPagerRow プロパティは、ItemCreated イベントで FormView コントロールによって下部のページ行が作成された後にしか使用できません。 |
このプロパティは通常、下部のページ行をプログラムから操作する必要がある場合 (カスタム コンテンツを追加する場合など) に使用されます。BottomPagerRow プロパティに対する変更は、すべて下部のページ行を表す FormViewRow オブジェクトが作成された後で実行する必要があります。そうしないと、FormView コントロールによって変更が上書きされます。

BottomPagerRow プロパティを使用して、FormView コントロールの下部に表示されるページ行にアクセスする方法を次の例に示します。その後、ページ行は、追加コンテンツで更新されます。
<%@ Page language="VB" %> <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> <body> <form 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>
<%@ Page language="C#" %> <script runat="server"> void EmployeeFormView_DataBound(Object sender, EventArgs e) { // Get the pager row. FormViewRow pagerRow = EmployeeFormView.BottomPagerRow; // Get the Label controls that display the current page information // from the pager row. Label pageNum = (Label)pagerRow.Cells[0].FindControl("PageNumberLabel"); Label totalNum = (Label)pagerRow.Cells[0].FindControl("TotalPagesLabel"); if ((pageNum != null) && (totalNum != null)) { // Update the Label controls with the current page values. int page = EmployeeFormView.PageIndex + 1; int count = EmployeeFormView.PageCount; pageNum.Text = page.ToString(); totalNum.Text = count.ToString(); } } </script> <html> <body> <form 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>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からFormView.BottomPagerRow プロパティを検索する場合は、下記のリンクをクリックしてください。

- FormView.BottomPagerRow プロパティのページへのリンク