Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is, accoring to your change, how I would do that :</p> <pre><code>public static Customers GetAllCustomer(int startIndex, int nbrOfResults, out total) { Customers customers = new Customers(); NShop_SmallEntities data = new NShop_SmallEntities(); var dbCustomers = from c in data.Customers select c; // Retreiving total number of customers. NEEDED to get // ObjectDataSource working. total = dbCustomers.Count(); foreach (var dbCustomer in dbCustomers .Skip((startIndex * nbrOfResults) + 1) .Take(NumberOfResults).ToList() { customers.Add(Customer.GetCustomer(dbCustomer)); } return customers; } /// &lt;summary&gt; /// This methods must have the same signature than the "real" one... exept the name :oP /// &lt;/summary&gt; public static int GetAllCustomerCount(int startIndex, int nbrOfResults, out total) { return (from c in data.Customers select c).Count(); } </code></pre> <p>And now in your page ; </p> <pre><code>&lt;asp:GridView ID="gvBulletins" runat="server" AllowPaging="True" ObjectDataSourceID="objCustomersDS"&gt; &lt;/asp:GridView&gt; &lt;asp:ObjectDataSource ID="objCustomersDS" runat="server" SelectMethod="GetAllCustomer" SelectCountMethod="GetAllCustomerCount" TypeName="AssemblyName" EnablePaging="True" MaximumRowsParameterName="nbrOfResults" StartRowIndexParameterName="startIndex"&gt; &lt;SelectParameters&gt; &lt;asp:Parameter Name="startIndex" Type="Int32" /&gt; &lt;asp:Parameter Name="nbrOfResults" Type="Int32" /&gt; &lt;asp:Parameter Direction="Output" Name="total" Type="Int32" /&gt; &lt;/SelectParameters&gt; &lt;/asp:ObjectDataSource&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload