I have the following code in front:
<cms:CMSRepeater ID="RepItems" runat="server" DataBindByDefault="false">
<ItemTemplate>
//code
</ItemTemplate>
</cms:CMSRepeater>
<div class="paging-bar flex">
<cms:UniPager ID="Pager" runat="server">
<PageNumbersTemplate>
//template code here
</PageNumbersTemplate>
</cms:UniPager>
</div>
And in the code behind I call this method in SetupControl()
var data = //call to webservice
if (!DataHelper.DataSourceIsEmpty(data))
{
RepItems.DelayedLoading = true;
RepItems.DataSource = data;
DataBind();
RepItems.ControlContext = ControlContext; //tried with and without
RepItems.EnablePaging = true; //tried with and without
RepItems.PageSize = PagingPageSize; //tried with and without
RepItems.UniPagerControl = Pager; //tried with and without
Pager.PageSize = PagingPageSize;
Pager.DisplayFirstLastAutomatically = true;
Pager.DisplayPreviousNextAutomatically = true;
Pager.HidePagerForSinglePage = true;
Pager.GroupSize = 3;
Pager.PageControl = RepItems.ID;
Pager.UseQueryParameterForFirstPage = true;
Pager.PagerMode = CMS.DocumentEngine.Web.UI.UniPagerMode.Querystring;
//DataBind();
}
But the repeater shows all the items with no paging. Is there something I'm missing? When debugging I get the expected values for PagingPageSize but Repeater.PageCount always gives me a value of 1.
I've followed everything according to the K12 docs https://docs.xperience.io/k12sp/developing-websites/kentico-controls/generic-controls/paging-controls/unipager
Try the BasicRepeater control instead of the CMSRepeater.