- if (this.dataGridView1.Columns[e.ColumnIndex].Name == "EX" && isEx == "true")
- {
- string id = this.dataGridView1.Rows[e.RowIndex].Cells["ID"].Value.ToString();
- DataTable table = GetDataTable("select * from Department where DparentId=" + id);
- if (table.Rows.Count > 0)
- {
- //利用Remove
- for (int i = 0; i < table.Rows.Count; i++)
- {
- foreach (DataGridViewRow row in this.dataGridView1.Rows)
- {
- if (row.Cells["ID"].Value.Equals(table.Rows[i]["ID"]))
- {
- this.dataGridView1.Rows.Remove(row);
- }
- }
- }
- }
- ////将IsEx设置为false,标明该节点已经收缩
- this.dataGridView1.Rows[e.RowIndex].Cells["IsEx"].Value = "false";
- this.dataGridView1.Rows[e.RowIndex].Cells["EX"].Value = "+";
- }
这