开发者

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

开发者 https://www.devze.com 2022-12-21 10:15 出处:网络
Every time you search for post on SOF, you can browse through the result with page-navigation feature. How do 开发者_如何学GoI create a Paging feature like SOF? I like that feature a lot.using MvcCont

Every time you search for post on SOF, you can browse through the result with page-navigation feature. How do 开发者_如何学GoI create a Paging feature like SOF? I like that feature a lot.


    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:

  • Powerful but easy paging with ASP.NET MVC
  • How do you implement paging in ASP.NET MVC?

EDIT: For Web-forms look at this Tutorial Series

  • Paging and Sorting


Use the powerful DataPager control.

Here's a tutorial:

http://west-wind.com/weblog/posts/127340.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+RickStrahl+%28Rick+Strahl%27s+WebLog%29

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号