GridView.EnableSortingAndPagingCallbacks プロパティ

定義

並べ替え操作とページング操作にクライアント側のコールバックを使用するかどうかを示す値を取得または設定します。

public:
 virtual property bool EnableSortingAndPagingCallbacks { bool get(); void set(bool value); };
public virtual bool EnableSortingAndPagingCallbacks { get; set; }
member this.EnableSortingAndPagingCallbacks : bool with get, set
Public Overridable Property EnableSortingAndPagingCallbacks As Boolean

プロパティ値

Boolean

並べ替え操作とページング操作にクライアント側のコールバックを使用する場合は true。それ以外の場合は false。 既定値は、false です。

例外

Columns コレクションにはコールバックをサポートしない列 (TemplateField など) が含まれています。

次の例では、このプロパティを使用 EnableSortingAndPagingCallbacks して、並べ替え操作とページング操作でクライアント側のコールバックを有効にする方法を示します。


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

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        emptydatatext="No data available." 
        allowpaging="true"
        allowsorting="true"
        enablesortingandpagingcallbacks="true"        
        runat="server">
                
      </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 EnableSortingAndPagingCallbacks Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>GridView EnableSortingAndPagingCallbacks Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        emptydatatext="No data available." 
        allowpaging="true"
        allowsorting="true"
        enablesortingandpagingcallbacks="true"        
        runat="server">
                
      </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 コントロールはサーバーにポストバックして操作を実行します。 プロパティを EnableSortingAndPagingCallbacks 設定 trueすると、並べ替え操作とページング操作を実行するためにクライアントでサービスが呼び出されるため、サーバーにポストバックする必要がなくなります。

注意

一部のブラウザーでこの機能がサポートされているわけではありません。 ブラウザーでこの機能がサポートされているかどうかを確認するには、このプロパティを SupportsCallback 使用します。

コレクション内のすべての列は、 Columns この機能を機能させるためにコールバックをサポートする必要があります。 コールバックをColumnsサポートしていない列がコレクションに含まれている場合は、TemplateFieldNotSupportedException例外が発生します。

適用対象

こちらもご覧ください