private void dataGridViewKJ1281_CellContentClick(object sender, DataGridViewCellEventArgs e) { int a = e.RowIndex; this.panel1.Visible = false; txtUser1.Text = ""; cbxisUse.Checked = true; dateTimePicker2.Value = DateTime.Now; cbxisEndDATE1.Checked = false; txtRemark1.Text = ""; if (e.ColumnIndex == 0 && e.RowIndex >= 0) { id = int.Parse(dgv_userGroup.Rows[a].Cells["ids"].Value.ToString()); txtUser1.Text = dgv_userGroup.Rows[a].Cells["UGName"].Value.ToString(); cbxisUse1.Checked = Convert.ToBoolean(dgv_userGroup.Rows[a].Cells["IsEnable"].Value.ToString()); cbxisEndDATE1.Checked = Convert.ToBoolean(dgv_userGroup.Rows[a].Cells["IsUseEndDate"].Value.ToString()); dateTimePicker2.Value = DateTime.Parse(dgv_userGroup.Rows[a].Cells["UseEndDate"].Value.ToString()); txtRemark1.Text = dgv_userGroup.Rows[a].Cells["remark"].Value.ToString(); panel1.Visible = true; } else { if (e.ColumnIndex == 1 && e.RowIndex >= 0) { id = int.Parse(dgv_userGroup.Rows[a].Cells["ids"].Value.ToString()); if (MessageBox.Show("删除用户组会将该用户组的所有用户删除,您确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { //存入日志 LogSave.Messages("[usergroupInfo]", LogIDType.UserLogID, "删除用户组,用户组名称:" + dgv_userGroup.Rows[a].Cells["UGName"].Value.ToString()); bll.DeleteByID(id, out strErr); if (strErr == "Succeeds") { usergroupInfo_Load(null, null); } else { MessageBox.Show(strErr); } } } } }