Freigeben über


GridView.EnableSortingAndPagingCallbacks Eigenschaft

Definition

Dient zum Abrufen oder Festlegen eines Werts, der angibt, ob clientseitige Rückrufe für Sortier- und Pagingvorgänge verwendet werden.

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

Eigenschaftswert

truezur Verwendung clientseitiger Rückrufe für Sortier- und Pagingvorgänge; andernfalls . false Der Standardwert lautet false.

Ausnahmen

Die Columns Auflistung enthält eine Spalte, die Keine Rückrufe unterstützt, z TemplateField. B. .

Beispiele

Im folgenden Beispiel wird die Verwendung der EnableSortingAndPagingCallbacks Eigenschaft zum Aktivieren clientseitiger Rückrufe für Sortier- und Pagingvorgänge veranschaulicht.


<%@ 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>

Hinweise

Wenn ein Sortier- oder Auslagerungsvorgang ausgeführt wird, sendet das GridView Steuerelement standardmäßig zurück an den Server, um den Vorgang auszuführen. Wenn die EnableSortingAndPagingCallbacks Eigenschaft auf true festgelegt ist, wird ein Dienst auf dem Client aufgerufen, um Sortier- und Auslagerungsvorgänge auszuführen, wodurch die Notwendigkeit, den Post zurück auf den Server zu stellen, beseitigt wird.

Hinweis

Nicht alle Browser unterstützen dieses Feature. Um festzustellen, ob ein Browser dieses Feature unterstützt, verwenden Sie die SupportsCallback Eigenschaft.

Alle Spalten in der Columns Auflistung müssen Rückrufe unterstützen, damit dieses Feature funktioniert. Wenn die Columns Auflistung eine Spalte enthält, die Keine Rückrufe unterstützt, z TemplateField. B. wird eine NotSupportedException Ausnahme ausgelöst.

Gilt für:

Weitere Informationen