AspNetPager有分页,但点下一页就显示无数据
求助!
用AspNetPager做分页,一页显示10条,特意增加了11条数据,能正确显示2页,但点下一页竟然没有数据!请问怎么解决?
代码:
public void Bind()
{
if (string.IsNullOrEmpty(_subNum))
{
_subNum = "10";
}
ds = manage.GetNewsListByName(_channelName,_parentName);
AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
AspNetPager1.PageSize = 3;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.PageSize = AspNetPager1.PageSize;
GvList.DataSource = pds;
GvList.DataBind();
//Response.Write("<script>alert('"+AspNetPager1.RecordCount.ToString()+"');</script>");
if (ds.Tables[0].Rows.Count > 0)
{
AspNetPager1.Visible = true;
}
else
{
AspNetPager1.Visible = false;
}
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
Bind();
}
急等,感谢!
用AspNetPager做分页,一页显示10条,特意增加了11条数据,能正确显示2页,但点下一页竟然没有数据!请问怎么解决?
代码:
public void Bind()
{
if (string.IsNullOrEmpty(_subNum))
{
_subNum = "10";
}
ds = manage.GetNewsListByName(_channelName,_parentName);
AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
AspNetPager1.PageSize = 3;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.PageSize = AspNetPager1.PageSize;
GvList.DataSource = pds;
GvList.DataBind();
//Response.Write("<script>alert('"+AspNetPager1.RecordCount.ToString()+"');</script>");
if (ds.Tables[0].Rows.Count > 0)
{
AspNetPager1.Visible = true;
}
else
{
AspNetPager1.Visible = false;
}
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
Bind();
}
急等,感谢!
...全文
相关推荐
自定义分页控件开发实例
自定义分页控件开发实例 自定义分页控件开发实例 自定义分页控件开发实例 自定义分页控件开发实例
分页AspNetPager
AspNetPager使用指南 一、AspNetPager支持两种方式分页: 一种是PostBack方式分页, 一种是通过Url来实现分页以及Url重写功能 二、AspNetPager支持各种数据绑定控件GridView、DataGrid、DataList、Repeater以及自定义的数据绑定控件的分页功能十分强大。 三、AspNetPager分页控件本身并不显示任何数据,而只显示分页导航元素,数据在页面上的显示方式与该控件无关,所以需要手写数据连接方法来配合, 四、结合TOP 。。。NOT IN 的通用存储过程分页方法使用AspNetPager十分实用
AspNetPager 一款强大的ASP .NET 分页控件
ASP .NET Webform 利用AspNetPager控制实现分页
AspNetPager+GridView实现分页的实例代码
AspNetPager+GridView实现分页的实例代码,需要的朋友可以参考一下
DataList+MySql+AspNetPager分页
DataList+MySql+AspNetPager分页


