简单实用的分页控件 AspNetPager.dll 的使用方法
2010-05-18 18:22
766 查看
前台页面的代码:
<webdiyer:AspNetPager Width="99%" urlpaging="true" urlpageindexname="page"
id="anp" morebuttontype="Text"
numericbuttontype="Text" pagingbuttontype="Image" pagesize="10" imagepath="http://www.cnblogs.com/Images/Page/"
alwaysshow="false" runat="server" showinputbox="Always" inputboxclass="Page_TextBox"
submitbuttonclass="" submitbuttontext="GO" textafterinputbox=" " horizontalalign="Right"
showcustominfosection="Left" custominfohtml="总记录数:0 总页数:0"
onpagechanged="anp_PageChanged" >
</webdiyer:AspNetPager>
后台代码:
protected void Pager1_PageChanged(object sender, EventArgs e)
{
OracleConnection objcon = this.getcon();
string querystr = "select * from stu";
OracleDataAdapter da = new OracleDataAdapter(querystr, objcon);
DataSet ds = new DataSet();
da.Fill(ds, "stu");
this.GridView1.DataSource = this.getPage(ds); /***主要的步骤在这里,调用下面的方法***/
this.GridView1.DataBind();
} public PagedDataSource getPage(DataSet ds)
{
this.Pager1.RecordCount = ds.Tables[0].Rows.Count;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.CurrentPageIndex = Pager1.CurrentPageIndex - 1;
pds.PageSize = Pager1.PageSize;
return pds;
}
<webdiyer:AspNetPager Width="99%" urlpaging="true" urlpageindexname="page"
id="anp" morebuttontype="Text"
numericbuttontype="Text" pagingbuttontype="Image" pagesize="10" imagepath="http://www.cnblogs.com/Images/Page/"
alwaysshow="false" runat="server" showinputbox="Always" inputboxclass="Page_TextBox"
submitbuttonclass="" submitbuttontext="GO" textafterinputbox=" " horizontalalign="Right"
showcustominfosection="Left" custominfohtml="总记录数:0 总页数:0"
onpagechanged="anp_PageChanged" >
</webdiyer:AspNetPager>
后台代码:
protected void Pager1_PageChanged(object sender, EventArgs e)
{
OracleConnection objcon = this.getcon();
string querystr = "select * from stu";
OracleDataAdapter da = new OracleDataAdapter(querystr, objcon);
DataSet ds = new DataSet();
da.Fill(ds, "stu");
this.GridView1.DataSource = this.getPage(ds); /***主要的步骤在这里,调用下面的方法***/
this.GridView1.DataBind();
} public PagedDataSource getPage(DataSet ds)
{
this.Pager1.RecordCount = ds.Tables[0].Rows.Count;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.CurrentPageIndex = Pager1.CurrentPageIndex - 1;
pds.PageSize = Pager1.PageSize;
return pds;
}
相关文章推荐
- 简单实用的分页控件 AspNetPager.dll 下载地址、使用方法、含有代码示例
- AspNetPager.dll 分页控件使用方法、含有代码示例 [转]
- AspNetPager分页控件--使用方法
- AspNetPager分页控件使用方法
- (转)AspNetPager分页控件的使用方法 (1)
- ASPNETPAGER分页控件的使用方法[图文]
- AspNetPager.dll 分页控件使用
- AspNetPager分页控件--使用方法 9
- AspNetPager分页控件的使用方法
- AspNetPager分页控件--使用方法 2
- ASPNETPAGER分页控件的使用方法[图文]
- AspNetPager分页控件使用方法
- AspNetPager分页控件使用方法(不使用DBAccess.cs文件)(二)
- AspNetPager分页控件使用方法
- DataList编辑、更新、取消、删除、分页(分页控件AspNetPager.dll)
- 一个简单实用的ASP调试函数和使用方法
- ASP.NET WebForm 分页控件 AspNetPager 使用的简单示例
- 实用的简单PHP分页集合包括使用方法
- ASP.NET-AspNetPager分页控件完整使用方法
- AspNetPager分页控件如何使用