GridView.PagerSettings プロパティ

定義

PagerSettings コントロールのページャー ボタンのプロパティを設定できるようにする GridView オブジェクトへの参照を取得します。

public:
 virtual property System::Web::UI::WebControls::PagerSettings ^ PagerSettings { System::Web::UI::WebControls::PagerSettings ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public virtual System.Web.UI.WebControls.PagerSettings PagerSettings { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.PagerSettings : System.Web.UI.WebControls.PagerSettings
Public Overridable ReadOnly Property PagerSettings As PagerSettings

プロパティ値

PagerSettings

PagerSettings コントロールのページャー ボタンのプロパティを設定できるようにする GridView オブジェクトへの参照。

属性

次の例では、プロパティを宣言によって設定する方法を PagerSettings 示します。 ページャー行のフォントと背景をそれぞれ青と水色に設定します。


<%@ 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 runat="server">
    <title>GridView AllowPaging Example</title>
</head>
<body>
    <form id="form1" 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="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 runat="server">
    <title>GridView AllowPaging Example</title>
</head>
<body>
    <form id="form1" 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>

注釈

プロパティを PagerSettings 使用して、コントロール内のポケットベル行の設定を GridView 制御します。 ページャーの行は、ページング機能が有効になっている場合に表示されます (プロパティをAllowPagingtrue設定することによって) と、ユーザーがコントロール内の別のページに移動できるようにするコントロールが含まれています。 このプロパティは読み取り専用です。ただし、返されるオブジェクトのプロパティを PagerSettings 設定できます。 プロパティは、次のいずれかの方法を使用して宣言によって設定できます。

  • フォーム内のコントロールProperty-Subpropertyの開始タグに属性をGridView配置します。これはSubpropertyオブジェクトのPagerSettingsプロパティです (たとえば)。 PagerSettings-Mode

  • コントロールの <PagerSettings> 開始タグと終了タグの間に要素を GridView 入れ子にします。

プロパティは、プログラムでフォームProperty.Subpropertyで設定することもできます (たとえば)。 PagerStyle.Mode 一般的な設定には、通常、ページャー行の表示モードと、ナビゲーション コントロールのカスタム テキストまたは画像が含まれます。

適用対象

こちらもご覧ください