C# 单元格值变更事件
gridPager1.gridView1.CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(this.gridView1_CellValueChanged);
private void gridView1_CellValueChanged(object sender, CellValueChangedEventArgs e)
{
if (gridPager1.gridView1.RowCount > 0 && e.RowHandle >= 0)
{
if (gridPager1.gridView1.FocusedColumn.FieldName == "Check" && e.Column.FieldName == "Check")
{
bool isChecked = this.gridPager1.gridView1.GetRowCellValue(e.RowHandle, gridPager1.gridView1.Columns["Check"]).ToBool();
string vender = this.gridPager1.gridView1.GetRowCellValue(e.RowHandle, gridPager1.gridView1.Columns["Vendor"]).ToStr();
if (isChecked)
{
foreach (DataRow item in poTable.Rows)
{
if (item["Vendor"].ToStr() == vender)
{
item["Check"] = true;
}
}
}
}
}
}