if(e.NewPageIndex>-1 && e.NewPageIndex<this.DataGrid1.PageCount)
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
}
else
DataGrid1.CurrentPageIndex=0; DataGrid1.DataBind();
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
}
else
DataGrid1.CurrentPageIndex=0; DataGrid1.DataBind();
解决方案 »
- .net用得最多,开源的,稳定成熟的博客是哪个
- WebService和autoEventWireup冲突的问题,如何解决?谢谢!
- .NET中的中简单问题
- Oracle里的Select分组统计问题。
- 无刷新技术的使用(Ajax),请您评论一下!
- iframe 的问题
- 奇怪的Replace与Split函数问题,为什么chr(10)与chr(13)不能同时被祛除????
- 如何做到让多个虚拟目录或站点指向同一个应用程序目录?谢谢,解决了马上兑现分数。
- 用ASP.NET怎样弹出一个上传文件的对话框,如果有,怎么做,点击上传文件以后,怎么样把客户端选中的图片在网页上显示?
- 页面wizard控件内动态表寿命
- 高分请教:把下载的控件添加到工具箱中的问题???
- 在网上的.net空间,用的是access数据库,现在这个数据库删除不掉了?
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
}
else
DataGrid1.CurrentPageIndex=0;
DataGrid1.DataBind();
下面是个简单的例子:SQLStatement="SELECT cnid, cnname, groupname FROM V_cnGroup GROUP BY cnid, cnname, groupname "+sqlstr+" ORDER BY cnid DESC";DataView dv=cService.SelectDataSet(SQLStatement,"V_cnGroup").Tables["V_cnGroup"].DefaultView;
MyDataGrid.DataSource=dv;
if(dv.Count % MyDataGrid.PageSize ==0)
{
iPagecount=dv.Count/MyDataGrid.PageSize;
}
else
{
iPagecount=dv.Count/MyDataGrid.PageSize+1;
}
if(iPagecount>iPageindex)
{
MyDataGrid.DataBind();
}
else
{
if(iPagecount>0)
{
MyDataGrid.CurrentPageIndex=iPagecount-1;
}
else
{
MyDataGrid.CurrentPageIndex=0;
}
MyDataGrid.DataBind();
}
行 166: DataGrid1.CurrentPageIndex=e.NewPageIndex;
行 167: DataGrid1.DataBind();//这个绑定函数有问题,你调用的是控件的绑定函数啊,需要绑定的是你自己写的数据库绑定函数,我以前就遇到过这样的问题,你将数据库绑定写到一个函数里面,然后在这里调用就可以了
行 168: }
行 169:好运
sqlDataAdapter1.Fill(dataSet11);
DataGrid1.DataSource = dataSet11;