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);
精彩评论