可下载数:19共享链接:http://163.fm/JGAryjI提取码:EjQa7jXM
1:ToolBox=>右击choose Items=>找到dll添加进来,然后进行将控件拖到页面上去
如:
<webdiyer:AspNetPager ID="AspNetPager2" runat="server" OnPageChanged="AspNetPager2_PageChanged1"
Width="500px" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"
Height="40px">
</webdiyer:AspNetPager>
2:在page_load方法里面,添加语句
RecordCount = GetBookList(0); //这里GetBookList是调用数据库获得数据,返回的是数据的所有个数。
AspNetPager2.AlwaysShow = true; //是否显示控件
AspNetPager2.PageSize = PageSize; //控件每一页放多少个
AspNetPager2.RecordCount = RecordCount; //一共有多少个。
3:
protected void AspNetPager2_PageChanged1(object sender, EventArgs e)
{
RecordCount = GetBookList(AspNetPager2.StartRecordIndex - 1);
}