我在DataGrid中删除数据时候,比如在删除第二页时,当第二页只剩一条记录,在删除时候就会出现“无效的 CurrentPageIndex 值。它必须大于等于 0 且小于 PageCount”,请问这问题怎么解决我是这么分页的
this.DataGrid1.CurrentPageIndex = e.NewPageIndex;
this.loadData();
this.DataGrid1.CurrentPageIndex = e.NewPageIndex;
this.loadData();
解决方案 »
- 谁做过跟地图或者平面图有关的系统?请教几个问题。
- 在asp 2.0 C# XmlDataSource相关问题
- 请问如何在javascript中获取并操作自定义控件的自定义属性?
- vs2005解决方案问题
- 送粉来啦! 高手出来指点一下啊!
- winform 数据量不大但总是卡死
- datagrid编辑模式下如何放入dropdownlist控件进行编辑更新
- 关于sessionID的问题
- 为了减少对数据库的访问次数,我想动态的生成静态页面,不知道此种方法是否可行?
- asp.net不能访问数据库!!!!!!!!!!!!!!!
- fckEditor上传提示 请先登录 的错误
- |zyciis| 我引用外部的DLL 但是总是提示:对 PInvoke 函数“ICCard!ICCard.Basic::rf_init”的调用导致堆栈不对称
/// 删除
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// //用户编号
// this.bus.S_id = int.Parse(e.Item.Cells[0].Text.Trim());
//
// //执行用户类的删除用户的方法
// this.bus.del_Spli();
//
// //删除最后一页的最后一项时
// if ( (this.DataGrid1.CurrentPageIndex == this.DataGrid1.PageCount - 1) && ( this.DataGrid1.Items.Count == 1) )
// {
// //如果还有其他页面时,则转到上一页
// if ( this.DataGrid1.CurrentPageIndex - 1 > 1 )
// {
// this.DataGrid1.CurrentPageIndex = this.DataGrid1.CurrentPageIndex - 1;
// }
// else //只剩最后一页时
// {
// this.DataGrid1.CurrentPageIndex = 0;
// }
// }
//
// //数据绑定
// this.bind_dg();