AspNetPager分页控件的使用
时间:2011-01-30 来源:cw_volcano
DataList1.DataSource = pds;
DataList1.DataBind();
}
protected void pager_PageChanged(object sender, EventArgs e)
{//分页事件,点击分页会改变CurrentPageIndex的值
Bind();
}
JYOnline分页控件在代码中:
1.
DataSet ds = bl.GetByQuery(strWhere, strOrder, AspNetPager1.CurrentPageIndex - 1, AspNetPager1.PageSize);
AspNetPager1.RecordCount = bllArticle.GetByQueryCount(strWhere);
2.protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
AspNetPager1.CurrentPageIndex = e.NewPageIndex;
BindArticle();
}
3.web.config中<system.web>下添加节点
<pages>
<controls>
<add assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagPrefix="webdiyer"/>
<add tagPrefix="EZC" assembly="StudyEZ.Controls" namespace="StudyEZ.Controls"/>
</controls>
</pages>
AspNetPager分页控件的使用:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetAllExams();
}
}
private void GetAllExams()
{
PagedDataSource pds = new PagedDataSource();
DataSet ds=bllpaper.GetAllExam();
AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
pds.AllowPaging = true;
pds.PageSize = AspNetPager1.PageSize;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.DataSource = ds.Tables[0].DefaultView;
this.RptExam.DataSource = pds;
this.RptExam.DataBind();
}
protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
AspNetPager1.CurrentPageIndex = e.NewPageIndex;
GetAllExams();
}