请教!!!如何实现 DataGrid中 按钮列的删除!!! 索引超出范围。必须为非负值并小于集合大小。参数名: index 是什么意思??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在 userid = DataGrid1.DataKeys(e.Item.ItemIndex) '获得主键值行提示错误! void MyDataGrid_Delete(Object sender, DataGridCommandEventArgs e) {//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// //dowith the Bug of Del&Page if((CartView.Count%MyDataGrid.PageSize==1)&&(MyDataGrid.CurrentPageIndex!=0)) MyDataGrid.CurrentPageIndex--;//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DataRow dr; String ID = e.Item.Cells[2].Text; // DEL_From_Grid(ID); // CartView.RowFilter = "ID='" + ID + "'"; if (CartView.Count > 0) CartView.Delete(0); CartView.RowFilter = ""; BindGrid(); } 判断当前page是不是只有一条记录!!!如果是,DataGrid1.CurrentPageIndex=0;( or DataGrid1.CurrentPageIndex=DataGrid1.CurrentPageIndex-1;; 用asp.net--vb这个该怎么编写? 到这去把c#转成vb.net的http://www.aspalliance.com/aldotnet/examples/translate.aspx 我想有两个原因;不知道你加了没有1.你的DataGrid 的DataKeyField设置主键ID没有2.你绑定到DataGrid的Table加主键了没有;DataColumn[] dcPk = {user_DS.Tables[tableName].Columns["ID"]}; //对一个Datauser_DS.Tables[tableName].PrimaryKey = dcPk; 把myDataGrid_DeleteCommand1事件里加上:if e.item.itemindex>=0 then....你的代码end if 有关extjs做的网站后台问题~! 套打程序 获取FileUpload的客户端的上传文件路径 MappingException:Unknown entity class:Provider.User VS2005系统提示”未将对象引用设置到对象的实例 “??? 只有10分了..超级奇怪的问题.. 我使用EnterpriseLibrary中的缓存模块,现在有下问题,请各位帮忙解答: 为什么别人给我分数,我的可用分没有加啊? 高手来看看这个问题应该如何解决 初学者问File Field 问题: asp.net 里的datagrid 分页的机制太费资源了??!! 有谁可以告诉我
userid = DataGrid1.DataKeys(e.Item.ItemIndex) '获得主键值
行提示错误!
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// //dowith the Bug of Del&Page
if((CartView.Count%MyDataGrid.PageSize==1)&&(MyDataGrid.CurrentPageIndex!=0))
MyDataGrid.CurrentPageIndex--;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DataRow dr;
String ID = e.Item.Cells[2].Text;
//
DEL_From_Grid(ID);
//
CartView.RowFilter = "ID='" + ID + "'";
if (CartView.Count > 0)
CartView.Delete(0);
CartView.RowFilter = "";
BindGrid();
}
如果是,
DataGrid1.CurrentPageIndex=0;
( or DataGrid1.CurrentPageIndex=DataGrid1.CurrentPageIndex-1;;
http://www.aspalliance.com/aldotnet/examples/translate.aspx
2.你绑定到DataGrid的Table加主键了没有;DataColumn[] dcPk = {user_DS.Tables[tableName].Columns["ID"]}; //对一个Data
user_DS.Tables[tableName].PrimaryKey = dcPk;