private void btnExecute_Click(object sender, EventArgs e) { var ids = new List <long>(); for (int i = 0; i < myGridViewBinding1.View.SelectedRows.Count; ++i) { if (Convert.ToBoolean(myGridViewBinding1.View.SelectedRows[i].Tag)) { continue; } ids.Add(Convert.ToInt64(myGridViewBinding1.GetCellValue(myGridViewBinding1.View.SelectedRows[i].Index, "tctId"))); } if (ids.Count == 0) { Commons.ShowInfoBox(this, "至少选中一项投标记录"); return; } btnExecute.Enabled = false; var dlg = new BatchProcessDlg(ids); dlg.StartPosition = FormStartPosition.CenterParent; dlg.RunSingle += (id) => Projects.CancelTenders(id).Result; dlg.ShowDialog(); UpdateTable1(); btnExecute.Enabled = true; }