<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:r开发者_如何学Celative;">--%><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>
How will I code paging on this site?
<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>
This isnt working , and if anybody know write it. And instead of previous and next i want paging with numbers .
You can't do paging with the help of a pager to your repeater as this is used for listview paging rather than as a repeater.
Have a look at this article that explain the steps to implement paging for repeater:
Adding Paging Support to the Repeater or DataList with the PagedDataSource Class
The ListView
control is better suited to your needs - especially as you want number paging.
Scott Guthrie has a great ListView and paging tutorial that takes you through what you want to do.
精彩评论