This project is read-only.

Pagination in storecontroller

Oct 7, 2012 at 5:18 AM

i have a large number of products and if i really dont apply paging ,the browse page will be way to crowded with data.

so im looking for a way to apply paging at the browse action in the storecontroller.

i tried something like this but it wont even work


public ActionResult Browse(string genre, int? page) {

const int pageSize = 10;
 // Retrieve Genre and its Associated Albums from database var genreModel = storeDB.Genres.Include("Albums") .Single(g => g.Name == genre);
var paginatedoutput = genreModel.Skip((page ?? 0) * pageSize).Take(pageSize).ToList();

 return View(paginatedoutput); }