how to add custom repeater and unipager

Khathun s asked on February 3, 2018 05:11

Hi Team, I have added a custom repeater with header and content in a transformation, and added cms unipager for pagination but data is displaying properly but pagination is not working please help me. and my code

<cms:CMSRepeater ID="listingRepeater" runat="server" PagerControl-CssClass="table table-striped" Path="/%"  DelayedLoading="true" OrderBy="NodeLevel, NodeOrder" DataBindByDefault="false" EnablePaging="true">
    </cms:CMSRepeater>
    <cms:UniPager ID="listingUniPager" runat="server" PageControl="listingRepeater" PageSize="4" GroupSize="4" PagerMode="PostBack">
        <PageNumbersTemplate>
            <a href="<%# Eval("ID") %>"><%# Eval("ID") %></a>
        </PageNumbersTemplate>
    </cms:UniPager>

and my code behind

    listingRepeater.DataSource = results;
    listingRepeater.EnablePaging = true;
    listingRepeater.UniPagerControl = listingUniPager;
    listingRepeater.DataBind();

Recent Answers


Trevor Fayas answered on February 5, 2018 15:25

I think your issue is you are setting the "PageControl" property of the Universal Viewer, but really this should be the "TargetControlName" (although this may depend on your version of Kentico, what version are you on?)

Another possibility is you may need to rebind the Pager after the listing is bound, so the pager re-loads with the proper data.

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on February 5, 2018 20:12

It is hard to guess. You should look in Kentico files for similar situation. Most likely you are missing some settings. Like this one: listingUniPager.PagedControl = listingRepeater;

0 votesVote for this answer Mark as a Correct answer

Babak Akbarzadeh answered on November 28, 2018 18:59

One problem I can see here is you're using CMSReaper instead of a BasicRepeater. If you modify your code as follows, I assume that your problem will be solved:

<cms:BasicRepeater ID="listingRepeater" runat="server">
</cms:BasicRepeater>

<cms:UniPager ID="listingUniPager" runat="server" PageControl="listingRepeater" PageSize="4" GroupSize="4">
   <PageNumbersTemplate>
      <a href="<%# Eval("ID") %>"><%# Eval("ID") %></a>
   </PageNumbersTemplate>
</cms:UniPager>

Please let me know if you've had any further questions.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.