Custom paging using LINQ

Posted by Raja under LINQ category on | Views : 7305
Below is the way to do custom paging using LINQ

Suppose you have a Repeater then write following to do the custom paging.
Here startRowIndex is the starting row from where the next result has to retrieve, pageSize is the number of rows you want to display in a page. products is your LINQ collection.

Repeater1.DataSource = products.Skip(startRowIndex).Take(pageSize);

You can get the startRowIndex and pageSize by using the querystring on the page where you are populating the Repeater control.

Hope this will help.

Comments or Responses

Login to post response