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

Forums / Developing with Sitefinity / How to use Repeater with a Pager control ?

How to use Repeater with a Pager control ?

4 posts, 0 answered
  1. David Martinez
    David Martinez avatar
    13 posts
    Registered:
    24 May 2010
    30 Nov 2010
    Link to this post

    I have a repeater which I paged through a Pager control, thanks, the code is as follows:

     

    <%

     

    @ Control Language="C#" AutoEventWireup="true" CodeFile="SearchResultsProducts.ascx.cs"

     

     

     

     

     

     

     

    Inherits="UserControls_Genomma_CustomerServicesForm" %>

     

    <%

     

    @ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

     

    <%

     

    @ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %>

     

     

     

     

    <

     

     

    div id="SearchResultProducts">

     

     

     

     

     

     

     

    <h2>

     

     

     

     

     

     

     

    <asp:Literal ID="ResultsStats" runat="server" meta:resourcekey="ResultsStats">Found {0} pages for "{1}" </asp:Literal></h2>

     

     

     

     

     

     

     

    <asp:Repeater ID="rptResults" runat="server">

     

     

     

     

     

     

     

    <HeaderTemplate>

     

     

     

     

     

     

     

    <dl class="searchResults">

     

     

     

     

     

     

     

    </HeaderTemplate>

     

     

     

     

     

     

     

    <ItemTemplate>

     

     

     

     

     

     

     

    <dt class="sf_SearchTextResult"><strong><a href='<%= PageProducts%>?bId=<%#DataBinder.Eval(Container.DataItem, "BrandID")%>'>

     

     

     

     

     

    <%

     

    #DataBinder.Eval(Container.DataItem, "ProductName")%></a></strong></dt>

     

     

     

     

     

     

     

    <dd class="sf_SearchTextResult">

     

     

     

     

     

    <%

     

    #DataBinder.Eval(Container.DataItem, "ProductDescription")%>

     

     

     

    </dd>

     

     

     

     

     

     

     

    <dd class="sf_SearchTextResult">

     

     

     

     

     

     

     

    <a href='<%#DataBinder.Eval(Container.DataItem, "ProductURI")%>'>

     

     

     

     

     

     

     

    <asp:Label ID="lblProdct" runat="server" Text="PRODUCTO -" meta:resourcekey="lblProductResource1"></asp:Label>&nbsp&nbsp&nbsp<%#DataBinder.Eval(Container.DataItem, "BrandName")%></a>

     

     

     

     

     

     

     

    </dd>

     

     

     

     

     

     

     

    <dd class="sf_SearchTextResult">

     

     

     

     

     

     

     

    <a href='<%= PageProducts%>?iId=<%#DataBinder.Eval(Container.DataItem, "IllnessID")%>'>

     

     

     

     

     

     

     

    <asp:Label ID="lblIllness" runat="server" Text="PADECIMIENTO -" meta:resourcekey="lblIllnessResource1"></asp:Label>&nbsp&nbsp&nbsp<%#DataBinder.Eval(Container.DataItem, "IllnessName")%></a>

     

     

     

     

     

     

     

    </dd>

     

     

     

     

     

     

     

    <dd class="sf_SearchTextResult">

     

     

     

     

     

     

     

    <a href='<%= PageProducts%>?dId=<%#DataBinder.Eval(Container.DataItem, "DivisionID")%>'>

     

     

     

     

     

     

     

    <asp:Label ID="lblDivision" runat="server" Text="DIVISION -" meta:resourcekey="lblDivisionResource1"></asp:Label>&nbsp&nbsp&nbsp<%#DataBinder.Eval(Container.DataItem, "DivisionName")%></a>

     

     

     

     

     

     

     

    </dd>

     

     

     

     

     

     

     

    <dd class="sf_SearchTextResult">

     

     

     

     

     

     

     

    <em class="sf_SearchTextResult"><a href='<%#DataBinder.Eval(Container.DataItem, "ProductURI")%>'>

     

     

     

     

     

    <%

     

    #DataBinder.Eval(Container.DataItem, "ProductURI")%></a> </em>

     

     

     

     

     

     

     

    </dd>

     

     

     

     

     

     

     

    </ItemTemplate>

     

     

     

     

     

     

     

    <FooterTemplate>

     

     

     

     

     

     

     

    </dl>

     

     

     

     

     

     

     

    </FooterTemplate>

     

     

     

     

     

     

     

    </asp:Repeater>

     

     

     

     

     

     

     

    <sfWeb:Pager ID="pager1" runat="server">

     

     

     

     

     

     

     

    <LayoutTemplate>

     

     

     

     

     

     

     

    <asp:Repeater ID="PageRepeaterLinkButton" runat="server">

     

     

     

     

     

     

     

    <HeaderTemplate>

     

     

     

     

     

     

     

    <ol>

     

     

     

     

     

     

     

    <li>

     

     

     

     

     

     

     

    <asp:LinkButton ID="PreviousPage" runat="server" Text="<%$Resources:PreviousPage %>"></asp:LinkButton></li>

     

     

     

     

     

     

     

    </HeaderTemplate>

     

     

     

     

     

     

     

    <ItemTemplate>

     

     

     

     

     

     

     

    <li>

     

     

     

     

     

     

     

    <asp:LinkButton ID="SingleItem" runat="server" />

     

     

     

     

     

     

     

    </li>

     

     

     

     

     

     

     

    </ItemTemplate>

     

     

     

     

     

     

     

    <FooterTemplate>

     

     

     

     

     

     

     

    <li>

     

     

     

     

     

     

     

    <asp:LinkButton ID="NextPage" runat="server" Text="<%$Resources:NextPage %>"></asp:LinkButton></li>

     

     

     

     

     

     

     

    </ol>

     

     

     

     

     

     

     

    </FooterTemplate>

     

     

     

     

     

     

     

    </asp:Repeater>

     

     

     

     

     

     

     

    <asp:Repeater ID="PageRepeaterHyperLink" runat="server">

     

     

     

     

     

     

     

    <HeaderTemplate>

     

     

     

     

     

     

     

    <ol>

     

     

     

     

     

     

     

    <li>

     

     

     

     

     

     

     

    <asp:HyperLink ID="PreviousPage" runat="server" Text="<%$Resources:PreviousPage %>"></asp:HyperLink></li>

     

     

     

     

     

     

     

    </HeaderTemplate>

     

     

     

     

     

     

     

    <ItemTemplate>

     

     

     

     

     

     

     

    <li>

     

     

     

     

     

     

     

    <asp:HyperLink ID="SingleItem" runat="server" />

     

     

     

     

     

     

     

    </li>

     

     

     

     

     

     

     

    </ItemTemplate>

     

     

     

     

     

     

     

    <FooterTemplate>

     

     

     

     

     

     

     

    <li>

     

     

     

     

     

     

     

    <asp:HyperLink ID="NextPage" runat="server" Text="<%$Resources:NextPage %>"></asp:HyperLink></li>

     

     

     

     

     

     

     

    </ol>

     

     

     

     

     

     

     

    </FooterTemplate>

     

     

     

     

     

     

     

    </asp:Repeater>

     

     

     

     

     

     

     

    </LayoutTemplate>

     

     

     

     

     

     

     

    </sfWeb:Pager>

     

    </

     

     

    div>

     

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    30 Nov 2010
    Link to this post
    Hi David,

    Does this work at all? I do not see where you set start index and end index of the items you are going to bind to get proper results when you are on an "i" page of the pager.

    Best wishes,
    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
  3. David Martinez
    David Martinez avatar
    13 posts
    Registered:
    24 May 2010
    30 Nov 2010
    Link to this post
    this works well, the data bind is done in code behind.  what section should I set start and end indexes?, Is there any example of using the Pager? I don't know in what section I can configure or bind the Pager. Thanks
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    30 Nov 2010
    Link to this post
    Hello David,

    1. You need to set the page size of the page
    2. You have to bind the control you use on the server and set the datasource depending on the selected page. You can use LINQ-SQL methods like Take, Skip.

    Greetings,
    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
Register for webinar
4 posts, 0 answered