需要在gridcontrol控件中触发CellValueChanging事件,为了在全选做批量操作时不遗漏最后一条数据。eg: private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
{
DataRowView drv = (DataRowView)this.dsApplyListBindingSource.Current;//当前选择行数据
if (drv != null)
{
if ((bool)drv["IsSelect"] == false)
{
foreach (DataRow dr in this.dsApplyList.DATApplyListStudent.Rows)
{
if (dr["ApplyID"].ToString() == drv["ApplyID"].ToString())
{
dr["IsSelect"] = true;
}
}
}
else if ((bool)drv["IsSelect"] == true)
{
foreach (DataRow dr in this.dsApplyList.DATApplyListStudent.Rows)
{
if (dr["ApplyID"].ToString() == drv["ApplyID"].ToString())
{
dr["IsSelect"] = false;
}
}
}
}
this.dsApplyListBindingSource.EndEdit();
gridControl1.MainView.PostEditor();
this.dsApplyList.DATApplyListStudent.AcceptChanges();//刷新数据集
}
属性窗口可以看事件呀!