Click here to Skip to main content
14,934,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a repeater on my books.aspx page which shows book reviews:

<asp:Repeater ID="Repeater1" runat="server">
            <asp:Repeater ID="ReviewRepeater" runat="server" DataSource='<%# Eval("Reviews") %>' ItemType="ELibraryModel.Review">
                    <div class="new_prod_box">
                        <a><asp:Label ID="DescriptionLabel" runat="server" Text='<%# Item.Title %>' /></a><br />
                        <div class="new_prod_bg">
                            <a><asp:HyperLink ID="HyperLink1" CssClass="thumb" runat="server" ImageUrl='<%# String.Format("../Images/books/{0}.jpg", Item.Id.ToString()) %>' Text='<%# Item.Title %>' NavigateUrl='<%# "../books/bookdetails.aspx?reviewId=" + Item.Id.ToString() %>'></asp:HyperLink></a>

Code behind:

using (ELibraryEntities entities = new ELibraryEntities())
            var allBooks = from books in entities.Books.Include("Reviews")
                                 orderby books.Category
                                 select new { books.Reviews};
            Repeater1.DataSource = allBooks;

Now, I want to implement pagination on this books.aspx page. I want to show only 8 reviews per page.


anonymouskrs 1-Apr-14 13:14pm
Thanks for help but can I use a GridView instead Repeater in this case? With GridView's AllowPaging="True" I think is more easy.
Tom Marvolo Riddle 2-Apr-14 0:10am
sorry for the late reply.yes,it's very easy to do with gridview.IF gridview is allowed to use ,then go with gridview
anonymouskrs 2-Apr-14 9:02am
Thanks for help Jas. Can you tell me if I can use a GridView with the code above. I need to use things like DataSource='<%# Eval("Reviews") %>' and Text='<%# Item.Title %>' but is showing me problems. I need to adapt the exact same code into the GridView because I need all Reviews with their corresponding Titles. I'm working on my Thesis so this is very important to me. Thanks.
Tom Marvolo Riddle 2-Apr-14 9:10am
you can do like this in Markup page or
Get values in Dataset/Datatable and bind it with gridview.

See eg here:[^]
This is not about Paging with repeater control, but an alternative:
Flexy Pager for ASP.NET WebForm & MVC[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900