使用中继器控制进行分页 [英] Paging with Repeater Control

查看:110
本文介绍了使用中继器控制进行分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的books.aspx页面上有一个转发器,显示书评:



 <   asp:Repeater    < span class =code-attribute> ID   =  Repeater1    runat   = 服务器 >  
< ItemTemplate >
< asp:Repeater ID = ReviewRepeater runat = server DataSource =' <% #Eval( 评论%> ' ItemType = ELibraryModel.Review >
< ItemTemplate >
< div class = new_prod_box >
< a > < asp:标签 ID = DescriptionLabel runat = server 文字 =' <%#Item.Title %> ' / > < / a > < br / >

< div class = new_prod_bg >
< a > ; < asp:HyperLink ID < span class =code-keyword> = HyperLink1 CssClass = thumb runat = server ImageUrl =' <%字符串 .Format( ../ Images / books / {0} .jpg,Item.Id.ToString())%> ' 文字 =' <%#Item.Title %> ' NavigateUrl =' <% ../ books / bookdetails.aspx?reviewId = + Item.Id.ToString()%> ' > < / asp:HyperLink > < / a >
< < span class =code-leadattribute> / div >

< ; / div >
< / ItemTemplate >
< / asp:Repeater >
< / ItemTemplate >
< / asp:Repeater >





代码背后:



 使用(ELibraryEntities entities =  new  ELibraryEntities())
{
var allBooks = 来自 books entities.Books .Include( 评论
orderby books.Category
选择 new {books.Reviews};
Repeater1.DataSource = allBooks;
Repeater1.DataBind();
}





现在,我想在这本books.aspx页面上实现分页。我想每页只显示8条评论。



谢谢。

解决方案

参考:

http://www.aspsnippets.com/Articles /Implement-Paging-in-Repeater-control-in-ASPNet.aspx [ ^ ]

允许使用C#在Repeater和DataList中进行寻呼 [ ^ ]


看看



http://asp.net-informations.com/ repeater / repeater-paging.htm [ ^ ]







使用直放站控制分页 [< a href =http://www.codeproject.com/Articles/31819/Pagination-with-Repeater-Controltarget =_ blanktitle =New Window> ^ ]


这不是关于使用转发器控制的分页,而是另一种选择:

用于ASP.NET WebForm& ;;的Flexy寻呼机MVC [ ^ ]

Hi,
I have a repeater on my books.aspx page which shows book reviews:

<asp:Repeater ID="Repeater1" runat="server">
       <ItemTemplate>
            <asp:Repeater ID="ReviewRepeater" runat="server" DataSource='<%# Eval("Reviews") %>' ItemType="ELibraryModel.Review">
                <ItemTemplate>
                    <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>
                        </div>
                    
                    </div>
                </ItemTemplate>
            </asp:Repeater>
        </ItemTemplate>
    </asp:Repeater>



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;
            Repeater1.DataBind();
        }



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

Thanks.

解决方案

Refer:
http://www.aspsnippets.com/Articles/Implement-Paging-in-Repeater-control-in-ASPNet.aspx[^]
Allow Paging in Repeater and DataList Using C# [^]


have a look

http://asp.net-informations.com/repeater/repeater-paging.htm[^]



Pagination with Repeater Control[^]


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


这篇关于使用中继器控制进行分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆