如何使用AspNetPager给DataList分页

来源:百度知道 编辑:UC知道 时间:2024/06/16 09:27:29
我建了一个搜索页面,当按用户按“确定”了后,将运行后台代码,大致如下
BookManager bm = new BookManager();
List<Books> list = bm.GetSearch(b);
this.DataList1.DataSource = list;
this.DataList1.DataBind();
BookManager是我发送和返回数据的业务类
Books是一个实体类
DataList1顾名思义就是我用来现实搜索到的东西的那个DataList,我将返回的list做为它的数据源
那么现在我想在DataList下面搞一个AspNetPager来分页
那么应该如何写?如果可以的话请把代码写给我看一下
第一次使用AspNetPager这个控件,不太清楚如何使用
谢谢了~~!!!

第一步,拷贝AspNetPager.dll文件在网站bin目录下
第二步,在要引用的页面上,注册该程序集
EG;<%@Register TagPrefix="Webdiyer" Namespace="Wuqi.Webdiyer" Assembly="aspnetpager"%>

第二步:在你想设置页码的位置,放置控件;
eg;<Webdiyer:AspNetPager runat="server" id="pager"
HorizontalAlign="right"
ShowCustomInfoSection="left"
style="margin-bottom:5px;"
ShowInputBox="always"
SubmitButtonStyle="border:1px solid #000066;height:18px;width:35px;margin-right:5px;"
InputBoxStyle="border:1px solid #000066;height:14px;width:35px;margin-right:5px;"
SubmitButtonText="转到"
NumericButtonTextFormatString="[{0}]"
OnPageChanged="Pager_OnChangePage"
Width="100%"
Height="22px"
ImagePath="./images"
MoreButtonType