+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Access Page Size on Blog List. .

Access Page Size on Blog List. .

3 posts, 1 answered
  1. HarryS
    HarryS avatar
    4 posts
    Registered:
    01 Nov 2006
    07 Oct 2010
    Link to this post
    Hi,

    Am after some suggestions on how best to access the 'page size' on the blog list view repeater?

    Within the admin section, I have set the page size to 'Display 10 items per page'.
    What I would like to do, is that when the users scrolls down to the bottom, rather then be presented with the telerik:pager; I am going to replace this with a 'Load More' link, which then loads another 10 stories directly underneath the original summaries.

    The bit of info I don't know how to do, is how to access the page-size of the current repeater?

    Hope that makes sense, and any help appreciated.

    Thanks,
    Harry
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Oct 2010
    Link to this post
    Hi HarryS,

    You need a custom control, because the default one binds only the first page and you will not be able to get the right results. You need to get all items by using GetContent method of the CmsManager. You need to render all items and use show() and hide() jQuery functions. to show a subset of items - say <li> elements. Another option is creating a client side binder, which is a more complex solution

    Here is a sample code

     <script  type="text/javascript">
     
         function pageLoad() {
             var itemsSize = ($('li.items').length);
             var pagesize = 5;
             var itemsToShow = itemsSize / pagesize;
             if (itemsSize > itemsToShow) {
                 hideItems(pagesize);
             }
         }
         function hideItems(pagesize) {
     
             $('li.items').each(function() {
                  if (($(this).index()) > pagesize) {
                     $(this).hide();
                 }
             })
          
         }
         function showItems() {
             $('li.items').each(function() {
                 $(this).show();
             });
             
         }
      
     </script>
     <asp:Repeater runat="server" ID="contentItems">
        <ItemTemplate>
           <li class="items">
              <asp:Literal runat="server" ID="ContentLiteral"></asp:Literal>
           </li>
        </ItemTemplate>
     </asp:Repeater>
      
     <asp:LinkButton runat="server" OnClientClick="showItems();return false;" ID="showmore" Text="showmore"></asp:LinkButton>


    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. HarryS
    HarryS avatar
    4 posts
    Registered:
    01 Nov 2006
    12 Oct 2010
    Link to this post
    Thanks Ivan; That worked a treat!
Register for webinar
3 posts, 1 answered