最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net 第三方控制实现分页代码的方法
时间:2022-06-25 06:58:09 编辑:袖梨 来源:一聚教程网
AspNetPager是第三方控件,下载地址:http://www.**we*bdiyer.com/AspNetPagerDocs/index.html。
然后通过Visaul Studio 2005的“选择项”把下载后的控件DLL加载到我们的控件工具箱中。
asp教程:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
PrevPageText="上一页" TextAfterPageIndexBox="页" TextBeforePageIndexBox ="转到" SubmitButtonText="Go" ShowPageIndexBox ="Always" LastPageText="尾页" NextPageText="下一页" ShowCustomInfoSection="Left" CustomInfoHTML="当前%CurrentPageIndex%页,共有%PageCount%页"
runat="server" OnPageChanging="AspNetPager1_PageChanging">
///
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
public void bind()
{
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Northwind.mdb");
OleDbCommand cmd = new OleDbCommand("select * from Customers", con);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
PagedDataSource ps教程 = new PagedDataSource();
ps.AllowPaging = true;
ps.CurrentPageIndex = this.AspNetPager1.CurrentPageIndex - 1;
ps.DataSource = ds.Tables[0].DefaultView;
this.GridView1.DataSource = ps;
this.GridView1.DataBind();
}
protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
this.AspNetPager1.CurrentPageIndex = e.NewPageIndex;
bind();
}
相关文章
- 《光与影 33号远征队》周年纪念销售数据更新 05-13
- 《光与影 33号远征队》的结局是这款RPG最精彩的部分 05-13
- 异环自选S级角色推荐 05-13
- 唐门技能攻略(唐门技能攻略详解,助你成为顶级强者) 05-13
- 她收藏的稀有宝可梦传说 阿尔宙斯卡牌数量史无前例 引发了广泛关注 05-13
- 据报道 早期玩家认为 Fairgames 试玩体验“乏味” 05-13