<asp:Repeater id="repeater1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<div id ="news">
<div style ="float:left;position:relative;margin-left:10px;margin-top:10px;"><asp:Image ID="lblImg" runat="server" src ='<%#Eval("ImageUrl") %>'></asp:Image></div>
<%--<div style ="position:relative;">--%><asp:Label ID="lblContent" runat="server" Text='<%#Eval("Subject") %>'></asp:Label><%--</div>--%>
<div style ="float:none;position:relative;"><asp:Label ID="lblTitle" runat="server" Text='<%#Eval("Description") %>'></asp:Label></div>
</div>
</ItemTemplate>
</asp:Repeater>我将如何在此站点上编写分页代码?
<div id="pager">
<asp:DataPager ID="dpgSearchResultsPager" runat="server" PagedControlID="lvwSearchResults">
<Fields>
<asp:NextPreviousPagerField ShowNextPageButton="False" ButtonCssClass="previousNextLink" />
<asp:NumericPagerField ButtonCount="10" ButtonType="Link" NumericButtonCssClass="numericLink" />
<asp:NextPreviousPagerField ShowPreviousPageButton="False" ButtonCssClass="previousNextLink" />
</Fields>
</asp:DataPager>
</div>这是行不通的,如果有人知道,那就写下来。而不是上一页和下一页,我想用数字分页。
发布于 2011-04-13 21:31:51
您不能在中继器的寻呼机的帮助下进行分页,因为中继器用于列表视图分页而不是中继器。
看看这篇文章,它解释了为中继器实现寻呼的步骤:
Adding Paging Support to the Repeater or DataList with the PagedDataSource Class
发布于 2011-04-13 20:19:12
ListView控件更适合您的需要-尤其是当您想要数字分页时。
Scott Guthrie有一个great ListView and paging tutorial,它可以引导你完成你想要做的事情。
https://stackoverflow.com/questions/5648877
复制相似问题