NextPreviousPagerField クラス

定義

ユーザーがデータのページ切り替えができるように、DataPager コントロール内のナビゲーション コントロールを表示するフィールドを表します。

public ref class NextPreviousPagerField : System::Web::UI::WebControls::DataPagerField
public class NextPreviousPagerField : System.Web.UI.WebControls.DataPagerField
type NextPreviousPagerField = class
    inherit DataPagerField
Public Class NextPreviousPagerField
Inherits DataPagerField
継承
NextPreviousPagerField

次の例は、オブジェクトを NextPreviousPagerField 使用して、コントロールに表示されるデータをページングする方法を ListView 示しています。

<%@ 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 id="Head1" runat="server">
    <title>NextPreviousPagerField Example</title>
  </head>
  <body>
    <form id="form1" runat="server">
        
      <h3>NextPreviousPagerField Example</h3>
          
      <asp:ListView ID="ContactsListView" 
        DataSourceID="ContactsDataSource"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" width="640px" border="1" runat="server" id="tblContacts">
            <tr id="itemPlaceholder" runat="server">
            </tr>
          </table>
        </LayoutTemplate>
        <ItemTemplate>
          <tr runat="server">
            <td>
              <asp:Label ID="ContactIDLabel" runat="server" Text='<%#Eval("ContactID") %>' />
            </td>
            <td>
              <asp:Label ID="FirstNameLabel" runat="server" Text='<%#Eval("FirstName") %>' />
            </td>
            <td>
              <asp:Label ID="LastNameLabel" runat="server" Text='<%#Eval("LastName") %>' />
            </td>
          </tr>
        </ItemTemplate>
      </asp:ListView>

      <asp:DataPager runat="server" ID="ContactsDataPager" PagedControlID="ContactsListView">
        <Fields>
          <asp:NextPreviousPagerField ShowFirstPageButton="true" ShowLastPageButton="true" />
        </Fields>
      </asp:DataPager>

      <!-- This example uses Microsoft SQL Server and connects      -->
      <!-- to the AdventureWorks sample database. Use an ASP.NET    -->
      <!-- expression to retrieve the connection string value       -->
      <!-- from the Web.config file.                                -->
      <asp:SqlDataSource ID="ContactsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
        SelectCommand="SELECT [ContactID], [FirstName], [LastName] FROM Person.Contact">
      </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 id="Head1" runat="server">
    <title>NextPreviousPagerField Example</title>
  </head>
  <body>
    <form id="form1" runat="server">
        
      <h3>NextPreviousPagerField Example</h3>
          
      <asp:ListView ID="ContactsListView" 
        DataSourceID="ContactsDataSource"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" width="640px" border="1" runat="server" id="tblContacts">
            <tr id="itemPlaceholder" runat="server">
            </tr>
          </table>
        </LayoutTemplate>
        <ItemTemplate>
          <tr runat="server">
            <td>
              <asp:Label ID="ContactIDLabel" runat="server" Text='<%#Eval("ContactID") %>' />
            </td>
            <td>
              <asp:Label ID="FirstNameLabel" runat="server" Text='<%#Eval("FirstName") %>' />
            </td>
            <td>
              <asp:Label ID="LastNameLabel" runat="server" Text='<%#Eval("LastName") %>' />
            </td>
          </tr>
        </ItemTemplate>
      </asp:ListView>

      <asp:DataPager runat="server" ID="ContactsDataPager" PagedControlID="ContactsListView">
        <Fields>
          <asp:NextPreviousPagerField ShowFirstPageButton="true" ShowLastPageButton="true" />
        </Fields>
      </asp:DataPager>

      <!-- This example uses Microsoft SQL Server and connects      -->
      <!-- to the AdventureWorks sample database. Use an ASP.NET    -->
      <!-- expression to retrieve the connection string value       -->
      <!-- from the Web.config file.                                -->
      <asp:SqlDataSource ID="ContactsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
        SelectCommand="SELECT [ContactID], [FirstName], [LastName] FROM Person.Contact">
      </asp:SqlDataSource>
      
    </form>
  </body>
</html>

注釈

このクラスは NextPreviousPagerField 、コントロール内のナビゲーション コントロールを表示するフィールドを DataPager 表します。 これらのナビゲーション コントロールを使用すると、コントロールなどのインターフェイスを実装 IPageableItemContainer するコントロールによって表示されるデータを ListView ページングできます。

この NextPreviousPagerField クラスには、ユーザーが一度に 1 ページずつデータのページ間を移動したり、データの最初または最後のページにジャンプしたりするためのボタンが用意されています。

プロパティを使用してButtonCssClassボタンのスタイルをNextPreviousPagerField設定することで、オブジェクトの外観をカスタマイズできます。 プロパティを ButtonType 使用して、表示されるボタンの種類を選択することもできます。 次の表に、使用可能なボタンの種類を示します。

[ボタンの種類] [説明]
Button Button コントロール。
Image ImageButton コントロール。
Link LinkButton コントロール。

プロパティを NextPreviousPagerField > に設定すると、 DataPager コントロール内のオブジェクトを Visible 非表示 falseにすることができます。 また、個々のボタン (最初のページ、前のページ、次のページ、最後のページのボタン) を非表示にするには、プロパティを > に設定ShowFirstPageButtonShowLastPageButtonShowPreviousPageButtonShowNextPageButtonfalseします。

このNextPreviousPagerFieldコントロールを使用すると、ボタンごとに 、、PreviousPageTextおよびNextPageTextプロパティをFirstPageText使用してカスタム テキストをLastPageText指定できます。

プロパティが ButtonType 設定 ButtonType.Imageされている場合は、ボタンに表示されるイメージの URL を指定する必要があります。 、、NextPageImageUrlおよびLastPageImageUrlプロパティを設定することで、ボタンごとに画像を個別にFirstPageImageUrlPreviousPageImageUrl設定できます。

プロパティを ButtonType 設定 ButtonType.Imageすると、対応するテキスト プロパティがイメージの代替テキストとして機能します。 たとえば、プロパティで FirstPageText 指定されたテキストは、最初のページの画像ボタンの代替テキストとして表示されます。 ツールヒントをサポートするブラウザーでは、このテキストもツールヒントとして表示されます。

コンストラクター

NextPreviousPagerField()

NextPreviousPagerField クラスの新しいインスタンスを初期化します。

プロパティ

ButtonCssClass

ブラウザーでページャー フィールドのボタンの表示に使用するカスケード スタイル シート (CSS: Cascading Style Sheet) クラスを取得または設定します。

ButtonType

ページャー フィールドに表示するボタンの種類を取得または設定します。

DataPager

DataPagerField オブジェクトが関連付けられているデータ ページャーへの参照を取得します。

(継承元 DataPagerField)
FirstPageImageUrl

最初のページに移動するボタン用に表示するイメージの URL を取得または設定します。

FirstPageText

最初のページに移動するボタンに表示されるテキストを取得または設定します。

IsTrackingViewState

DataPagerField オブジェクトでビューステートの変化を追跡しているかどうかを示す値を取得します。

(継承元 DataPagerField)
LastPageImageUrl

NextPreviousPagerField オブジェクトで最後のページに移動するボタン用に表示するイメージの URL を取得または設定します。

LastPageText

最後のページに移動するボタンに表示されるテキストを取得または設定します。

NextPageImageUrl

NextPreviousPagerField オブジェクトで次のページに移動するボタン用に表示するイメージの URL を取得または設定します。

NextPageText

次のページに移動するボタンに表示されるテキストを取得または設定します。

PreviousPageImageUrl

NextPreviousPagerField オブジェクトで前のページに移動するボタン用に表示するイメージの URL を取得または設定します。

PreviousPageText

前のページに移動するボタンに表示されるテキストを取得または設定します。

QueryStringHandled

クエリ文字列フィールドが評価されたかどうかを示す値を取得または設定します。

(継承元 DataPagerField)
QueryStringValue

要求の URL からクエリ文字列フィールドの値を取得します。

(継承元 DataPagerField)
RenderDisabledButtonsAsLabels

無効なボタンを Label コントロールとして NextPreviousPagerField オブジェクトに表示するかどうかを示す値を取得または設定します。

RenderNonBreakingSpacesBetweenControls

コントロールの間に非区切りスペースを表示するかどうかを示す値を取得または設定します。

ShowFirstPageButton

最初のページに移動するボタンが NextPreviousPagerField オブジェクトに表示されるかどうかを示す値を取得または設定します。

ShowLastPageButton

最後のページに移動するボタンが NextPreviousPagerField オブジェクトに表示されるかどうかを示す値を取得または設定します。

ShowNextPageButton

次のページに移動するボタンが NextPreviousPagerField オブジェクトに表示されるかどうかを示す値を取得または設定します。

ShowPreviousPageButton

前のページに移動するボタンが NextPreviousPagerField オブジェクトに表示されるかどうかを示す値を取得または設定します。

ViewState

同一のページに対する複数の要求にわたって、DataPagerField オブジェクトのビューステートを保存し、復元できるようにする状態情報のディクショナリを取得します。

(継承元 DataPagerField)
Visible

データ ページャー フィールドを表示するかどうかを示す値を取得または設定します。

(継承元 DataPagerField)

メソッド

CloneField()

DataPagerField から派生した現在のオブジェクトのコピーを作成します。

(継承元 DataPagerField)
CopyProperties(DataPagerField)

NextPreviousPagerField オブジェクトの現在のプロパティを、指定された DataPagerField オブジェクトにコピーします。

CreateDataPagers(DataPagerFieldItem, Int32, Int32, Int32, Int32)

ページャー フィールド オブジェクトのユーザー インターフェイス (UI) コントロールを作成し、指定のコンテナーに追加します。

CreateField()

NextPreviousPagerField クラスの新しいインスタンスを作成して返します。

Equals(Object)

指定したオブジェクトが、現在の NextPreviousPagerField オブジェクトと等しいかどうかを判断します。

GetHashCode()

NextPreviousPagerField クラスのハッシュ関数として機能します。

GetQueryStringNavigateUrl(Int32)

指定のページ番号を持つクエリ文字列フィールドが含まれる URL を作成します。

(継承元 DataPagerField)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
HandleEvent(CommandEventArgs)

NextPreviousPagerField コントロールで発生するイベントを処理し、適切なアクションを実行します。

LoadViewState(Object)

以前に保存したビューステート情報を復元します。

(継承元 DataPagerField)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
OnFieldChanged()

FieldChanged イベントを発生させます。

(継承元 DataPagerField)
SaveViewState()

DataPagerField オブジェクトのビューステートに加えられた変更を保存します。

(継承元 DataPagerField)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
TrackViewState()

DataPagerField オブジェクトがそのビューステートの変更を追跡するようにします。これにより、変更をコントロールの ViewState プロパティに格納し、同じページに対する複数の要求の間で保持できるようになります。

(継承元 DataPagerField)

明示的なインターフェイスの実装

IStateManager.IsTrackingViewState

DataPagerField オブジェクトでビューステートの変化を追跡しているかどうかを示す値を取得します。

(継承元 DataPagerField)
IStateManager.LoadViewState(Object)

以前に保存したビューステート情報を復元します。

(継承元 DataPagerField)
IStateManager.SaveViewState()

DataPagerField オブジェクトのビューステートに加えられた変更を保存します。

(継承元 DataPagerField)
IStateManager.TrackViewState()

DataPagerField オブジェクトがそのビューステートの変更を追跡するようにします。これにより、変更をコントロールの ViewState プロパティに格納し、同じページに対する複数の要求の間で保持できるようになります。

(継承元 DataPagerField)

適用対象

こちらもご覧ください