Using kentico api CmsRepeat, CmsDataGrid ,CmsDataList etc pagelist ?

Unal UN asked on November 27, 2017 08:27

Hello, I use custom tables with Kentico. Using kentico api CmsRepeat, CmsDataGrid, CmsDataList I want to make a pagelist

Example 1-2-3-4 pagelist

Can you help me ?

Recent Answers


Mariia Hrytsai answered on November 27, 2017 16:09

You can use paging of CMSRepeater. See properties here https://docs.kentico.com/k10/references/kentico-controls/cms-controls/cms-controls-listings-and-viewers/cmsrepeater. Set EnablePaging to true, set PageSize property.

Or you can user UniPager. example can be found here: https://docs.kentico.com/k10/references/kentico-controls/generic-controls/paging-controls/unipager

2 votesVote for this answer Mark as a Correct answer

Unal UN answered on November 30, 2017 11:32 (last edited on November 30, 2017 11:33)

Resolved Thank you.

Code Samples //

<cms:BasicRepeater ID="RpBasicDoctor" runat="server">
                        <ItemTemplate>
                              <li>
                            <div class="g-g">
                                <div class="g-u-1-6">
                                    <img alt="<%#Eval("FullName") %>" src="~/App_Themes/Training2017/assets/doctors/<%#Eval("Image") %>" />
                                </div>
                                <div class="g-u-5-6">
                                    <a href="Doktordetail.aspx?ItemID=<%#Eval("ItemID") %>">
                                        <h3><%#Eval("FullName") %></h3>
                                    </a>
                                    <p><%#Eval("Branch") %></p>
                                </div>
                            </div>
                        </li>

                        </ItemTemplate>
                    </cms:BasicRepeater>

                    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                    <br />
                    <asp:HyperLink ID="HyperLink1" runat="server">Next</asp:HyperLink>
                    <asp:HyperLink ID="HyperLink2" runat="server">Back</asp:HyperLink>


    var ds = CustomTableItemProvider.GetItems("customtable.MyDoctors").ToList();
    PagedDataSource pds = new PagedDataSource();
    pds.DataSource = ds;
    pds.AllowPaging = true;
    pds.PageSize = 2;
    int currentPage;

    if (Request.QueryString["page"] != null)
    {
        currentPage = Int32.Parse(Request.QueryString["page"]);
    }
    else
    {
        currentPage = 1;
    }

    pds.CurrentPageIndex = currentPage - 1;
    Label1.Text = "Page: " + currentPage + " / " + pds.PageCount;

    if (!pds.IsFirstPage)
    {
        HyperLink1.NavigateUrl = "~/doctor.aspx?page=" + (currentPage - 1);
    }

    if (!pds.IsLastPage)
    {
        HyperLink2.NavigateUrl = "~/doctor.aspx?page=" + (currentPage + 1);
    }

    RpBasicDoctor.DataSource = pds;
    RpBasicDoctor.DataBind();
0 votesVote for this answer Mark as a Correct answer

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