DevExpress GridView如何删除选择的多行并且同时删除数据库数据
DevExpress GridView 如何删除选择的多行并且同时删除数据库数据,本人已做了DataSet绑定,希望给出详细的参考代码和过程,谢谢大家的帮忙了。
------解决方案-------------------- 获取选择行的RowHandle,
int[] rowHandles = gridViewSub.GetSelectedRows();
for (int i = 0; i < rowHandles.Length; i++)
{
根据选择的主键删除数据库里的数据
//VillageProject entity = gridViewSub.GetRow(rowHandles[i]) as VillageProject;
long projectId = Convert.ToInt64(projectTable.Rows[rowHandles[i]][18].ToString());
string where = string.Format(" ID={0}", projectId);
projectDAO.Delete(where);
}
this.gridViewSub.DeleteRow(rowHandles);