How do you implement paging in ASP.NET MVC?

后端 未结 4 1493
天涯浪人
天涯浪人 2021-02-13 14:05

Currently, I\'m using a strategy found on many blog posts. Basically, the URL contains the page number (e.g. /Users/List/5 will give you the users on page 5 of your paged list

4条回答
  •  你的背包
    2021-02-13 14:31

    Ignoring routes for just a minute, you'll just keep the state of the 2 different pages in the URL as querystring parameters.

    mysite.com/foo?list1page=2&list2page=8

    Then you build the data/pagers accordingly. The pager links will just update the url.

    You can get creative with routes to create more friendly URLs, but I think querystring params are perfectly acceptable here.

提交回复
热议问题