GridView.AllowPaging プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > GridView.AllowPaging プロパティの意味・解説 

GridView.AllowPaging プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

ページング機能が有効かどうかを示す値を取得または設定します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Overridable Property
 AllowPaging As Boolean
Dim instance As GridView
Dim value As Boolean

value = instance.AllowPaging

instance.AllowPaging = value
public virtual bool AllowPaging { get;
 set; }
/** @property */
public boolean get_AllowPaging ()

/** @property */
public void set_AllowPaging (boolean value)

プロパティ値
ページング機能が有効な場合は true。それ以外の場合は false。既定値は false です。

解説解説

GridView コントロールでは、データ ソース内のすべてのレコードを同時に表示せずに、自動的にレコードを複数のページに分割できます。データ ソースでページング機能がサポートされている場合、GridView コントロールは、その機能を利用して組み込みのページング機能を提供できます。ページング機能は、System.Collections.ICollection インターフェイスをサポートするデータ ソース オブジェクト、またはページング機能をサポートするデータ ソースで使用できます。

ページング機能を有効にするには、AllowPaging プロパティを true に設定します。既定では、GridView コントロールは一度に 1 ページあたり 10 個のレコードを表示します。PageSize プロパティを設定して、ページに表示されるレコード数を変更できます。データ ソースの内容を表示するために必要な合計ページ数を確認するには、PageCount プロパティを使用します。PageIndex プロパティを使用して、現在表示されているページのインデックスを確認できます。

ページングが有効になっている場合、ページ行と呼ばれる追加行が自動的に GridView コントロールに表示されます。ページ行には、ユーザーが他のページに移動できるコントロールが含まれています。ページ行の設定 (ページャ表示モード、一度に表示するページ リンクの数、ページャ コントロールのテキスト ラベルなど) は、PagerSettings プロパティを使用して制御できます。ページ行は、Position プロパティを設定することによって、コントロールの上部、下部または上部と下部の両方に表示できます。また、Mode プロパティを設定して、4 つの組み込みのページャ表示モードのいずれかを選択することもできます。この組み込みの表示モードを次の表に示します。

ページ行の外観 (背景色、フォントの色、位置など) を制御するには、PagerStyle プロパティを使用します。

GridView コントロールでは、ページ行用のカスタム テンプレートも定義できます。カスタム ページ行テンプレートの作成の詳細については、PagerTemplate のトピックを参照してください。

GridView コントロールには、ページングが発生したときにカスタム アクションを実行するために使用できる複数のイベントが用意されています。使用できるイベントの一覧を次の表に示します。

使用例使用例

AllowPaging プロパティを使用して、GridView コントロールのページング機能を宣言によって有効にする方法を次のコード例に示します。

<%@ Page language="VB" %>

<html>
  <body>
    <form runat="server">
        
      <h3>GridView AllowPaging Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        emptydatatext="No data available." 
        allowpaging="true" 
        runat="server">
                
        <pagersettings mode="Numeric"
          position="Bottom"           
          pagebuttoncount="10"/>
                      
        <pagerstyle backcolor="LightBlue"
          height="30px"
          verticalalign="Bottom"
          horizontalalign="Center"/>
                
      </asp:gridview>
            
      <!-- 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="CustomersSource"
        selectcommand="Select [CustomerID], [CompanyName], [Address],
 [City], [PostalCode], [Country] From [Customers]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
 
        runat="server"/>
        
    </form>
  </body>
</html>

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

<html>
  <body>
    <form runat="server">
        
      <h3>GridView AllowPaging Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        emptydatatext="No data available." 
        allowpaging="true" 
        runat="server">
                
        <pagersettings mode="Numeric"
          position="Bottom"           
          pagebuttoncount="10"/>
                      
        <pagerstyle backcolor="LightBlue"
          height="30px"
          verticalalign="Bottom"
          horizontalalign="Center"/>
                
      </asp:gridview>
            
      <!-- 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="CustomersSource"
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City],
 [PostalCode], [Country] From [Customers]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
 
        runat="server"/>
        
    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GridView クラス
GridView メンバ
System.Web.UI.WebControls 名前空間
System.Web.UI.WebControls.PagerSettings
System.Web.UI.WebControls.TableItemStyle
PageCount
PageIndex
PagerSettings
PagerStyle
PagerTemplate
PageSize
PageIndexChanged
PageIndexChanging



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「GridView.AllowPaging プロパティ」の関連用語

GridView.AllowPaging プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



GridView.AllowPaging プロパティのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS