无效的 CurrentPageIndex 值。它必须大于等于 0 且小于 PageCount。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Web.HttpException: 无效的 CurrentPageIndex 值。它必须大于等于 0 且小于 PageCount。源错误:
行 268:
行 269: DataGrid1.DataSource = dv;
行 270: DataGrid1.DataBind();
行 271: string counmpage;
行 272: //分页按钮
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Web.HttpException: 无效的 CurrentPageIndex 值。它必须大于等于 0 且小于 PageCount。源错误:
行 268:
行 269: DataGrid1.DataSource = dv;
行 270: DataGrid1.DataBind();
行 271: string counmpage;
行 272: //分页按钮
解决方案 »
- AJAX局部刷新的问题
- 疯了,datagrid中插入CheckBoxList但怎么取得CheckBoxList的值。。
- 求一高效MSSQL分页存储过程
- 请问.rar文件的mime类型是什么?
- =========输出三条记录,怎么做,大哥?=======
- FreeTextBox文本编辑器问题
- datagrid做了分页,为什么第一页能显示出来,但是第二页却什么都没有呢? 请指教
- 关于repeater重写
- WebForm无法调试,错误如下,环境是windows2003+Visual Studio 2003,请问哪位高手能帮我解决,谢谢
- asp.net(webform)中客户端能否导出报表到excel、word...中,高分求英雄相救!
- [求助]第一次发200分贴,
- 如何自定义设置图表参数
/// <summary>
/// 绑定新闻
/// </summary>
protected void DBView()
{ DataTable newsList = TuanNewsService.GetAllNews().Tables[0];
PagedDataSource pds = new PagedDataSource();
pds.DataSource = newsList.DefaultView;
anpTuanNews.RecordCount = newsList.Rows.Count;
pds.CurrentPageIndex = anpTuanNews.CurrentPageIndex - 1;
pds.PageSize = anpTuanNews.PageSize;
pds.AllowPaging = true;
this.rptTypeNews.DataSource = pds;
this.rptTypeNews.DataBind(); //var newsList = SqlHelper.GetDataSet(sql).Tables[0];
}
看来是分页控件属性设置问题吧
DataGrid1.DataBind();
DataSource();
OnPageChanged事件是这样写得
protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex; ;
DataSource();
}
Message = "暂无记录!"; rpt_CirNoList.DataSource = list_no;
rpt_CirNoList.DataBind();你判断下,如果数据为空的话提示,不为空的时候就绑定数据。
if (Request.QueryString["pageid"] != null && Convert.ToInt32(Request.QueryString["pageid"]) > 0 && Convert.ToInt32(Request.QueryString["pageid"]) <= pds.PageCount)
{
pageindex = Convert.ToInt32(Request.QueryString["pageid"]);
}
else if (Convert.ToInt32(Request.QueryString["pageid"]) > pds.PageCount)
{
pageindex = pds.PageCount;
}
else
{
pageindex = 1;
}