Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Pagination is broken #153

Open
WDev20 opened this issue Nov 5, 2020 · 1 comment
Open

[Bug] Pagination is broken #153

WDev20 opened this issue Nov 5, 2020 · 1 comment

Comments

@WDev20
Copy link

WDev20 commented Nov 5, 2020

Hi,
The paging calculation isn't working properly (I'm referring to the Index.cshtml view of the BlogController).
`
@{
int currentPage = int.Parse(ViewContext.RouteData.Values[Constants.page] as string ?? "0");

int pageCount;
pageCount = int.TryParse(ViewData[Constants.TotalPostCount].ToString(), out pageCount) ? 0 : pageCount / 2;

}
`

The pageCount isn't calculated properly.

@BizTron
Copy link

BizTron commented Feb 19, 2021

//pageCount = int.TryParse(ViewData[Constants.TotalPostCount].ToString(), out pageCount) ? 0 : pageCount / 2;
pageCount = int.TryParse(ViewData[Constants.TotalPostCount].ToString(), out pageCount) ? (pageCount - 1) / settings.Value.PostsPerPage : 0;

Someone posted something similar, but I implemented this and it appears to work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants