开发者

If you know the current page, and total page count, how to mimick paging like google?

Having a tough time figuring out the start and end for my loop.

I am looping and generating links for pages for a pager.

No matter what page the user is on, I want to show 10 links BEFORE and AFTER the current page.

just like google does.

I need help calculating the start and end for this loop.开发者_Python百科


for(int i = Math.Max(pageNum - 10, 1); i <= Math.Min(pageNum + 10, maxPage); ++i)
  WritePageLink(i);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜