其使用是通过储存过程来实现的
储存过程如下:
CREATE Procedure Pr_AritleAllInfo
(@PageSize int, @PageIndex int, @Docount bit) As Set nocount on If(@docount=1) Select count(*) from Aritle Else Begin Declare @indextable table(id int identity(1,1) , KeyNo uniqueidentifier) Declare @PageLowerBound int Declare @PageUpperBound int Set @PageLowerBound=(@PageIndex-1)*@PageSize Set @PageUpperBound=@PageLowerBound+@PageSize Set RowCount @PageUpperBound Insert into @indextable(KeyNo) select KeyNo From Aritle order by AddTime desc Select O.* from Aritle O,@indextable t where O.KeyNo=t.KeyNo And t.id>@PageLowerBound and t.id< =@PageUpperBound order by t.id End GO Default.apx页面:
<%@ Register TagPrefix="cc1" Namespace="Wuqi.Webdiyer" Assembly="aspnetpager" %>
<
center
>
<asp:DataList ID="DataList1" runat="server">
<HeaderTemplate><table width="760" border="0" cellspacing="0" cellpadding="0" style="border-bottom:1px dotted #ccc;" id="table5" ></HeaderTemplate>
<ItemTemplate >
<tr>
<td>
●<%#Eval("title") %></td>
</tr></ItemTemplate>
<FooterTemplate ></table></FooterTemplate>
</asp:DataList>
<table border="0" cellpadding="0" style="border-collapse: collapse; background-color: #f5f5f5;" width="760" id="table1" class="mu6" height="20">
<tr>
<td style="height: 25px">
<Webdiyer:AspNetPager id="Pager" runat="server" HorizontalAlign="Right" FirstPageText="<<" LastPageText=">>" PrevPageText="<" NextPageText=">" NumericButtonTextFormatString="-{0}-" Width="760px"
ShowCustomInfoSection="Left" ShowBoxThreshold="2" PageSize="5" OnPageChanged="pager_PageChanged" InputBoxClass="text2" TextAfterInputBox="" />
</td>
</tr>
</
table
>
</center>
2007/08/01 15:45
|
AspNetPager的使用 1 (分页存储过程) AspNetPager 分页2(普通分页)
最新推荐文章于 2013-07-30 15:41:00 发布
AspNetPager的使用 1 (分页存储过程)
2008-04-29 下午 09:35