开发者

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

开发者 https://www.devze.com 2023-01-19 11:30 出处:网络
Having a tough time figuring out the start and end for my loop. I am looping and generating links for pages for a pager.

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

精彩评论

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

关注公众号