Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8901

Kentico Pager.PageCount 0 when page param exceeds page count

$
0
0
Is there a way to get the Pager.PageCount value when the page param exceeds the max number of pages available?In the below code totalPages = 3 so long as the page param is between 1 and 3.However, if the page param is @ 3, the value for totalPages = 0. I want to get the value for totalPages so I can redirect the client to the last page.private void InitRepeater() { RepItems.ClassNames = ClassNames; RepItems.MaxRelativeLevel = MaxRelativeLevel; RepItems.OrderBy = OrderBy; RepItems.SelectTopN = SelectTopN; RepItems.Path = Path; RepItems.FilterOutDuplicates = true; RepItems.SelectOnlyPublished = true; RepItems.SelectedColumns = GetSelectedColumns(); SetCategories(); Pager.PageSize = PagingPageSize; Pager.DisplayFirstLastAutomatically = true; Pager.DisplayPreviousNextAutomatically = true; Pager.HidePagerForSinglePage = true; Pager.GroupSize = 3; Pager.PageControl = RepItems.ID; Pager.UseQueryParameterForFirstPage = true; DataBind(); var currentPage = Pager.CurrentPage; var totalPages = Pager.PageCount; WebpartExtensions.ValidatePageParam((ulong)currentPage, (ulong)totalPages); WebpartExtensions.UpdateSEOBotLinks(Page, currentPage, totalPages); }

Viewing all articles
Browse latest Browse all 8901

Trending Articles