private void btnAlertRule_Delete_Click(object sender, EventArgs e) { DataGridViewSelectedRowCollection dr = gvAlertRule.SelectedRows; DialogResult result = MessageBox.Show( "Confirm delete this record?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { for (int i = 0; i < dr.Count; i++) { string AlertName = dr[i] .Cells[AttributeHelper.GetColumnIndex <ConfigModel.AlertRule>("alertName")].Value.ToString(); ConfigUtil.DeleteAlertRuleByName(AlertName); } } RefreshConfig(); initAlertRuleDataView(); gvAlertRule.Update(); gvAlertRule.Refresh(); }