Tola
Tola

Reputation: 2421

How Do I Create a Paging Feature like SOF with ListView?

Every time you search for post on SOF, you can browse through the result with page-navigation feature. How do I create a Paging feature like SOF? I like that feature a lot.

Upvotes: 0

Views: 127

Answers (2)

Asad
Asad

Reputation: 21938

    using MvcContrib.Pagination;
    public ActionResult Index(int? page)
    {
      var pageNo = page?? 1; // default to page 1
      var someEnumerable  = GetData(); // returns your collection
      var cutomPage = 
         PaginationHelper.AsPagination<SomeObject>(someEnumerable  , pageNo);
      return View(“Index”, CustomPage);
    }

Also have a look at this tutorial: NerdDinner Step 8: Paging Support

var paginatedDinners = upcomingDinners.Skip(10).Take(20).ToList();

references:


EDIT: For Web-forms look at this Tutorial Series

Upvotes: 1

Related Questions