private void btnDel_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count > 0) { var commodityType = this.dataGridView1.SelectedRows[0].Tag as CommodityTypeModel; var result = WebRequestUtil.DeleteCommodityType(commodityType.TypeId); if (result != null) { bool res = JsonUtil.Deserialize <QSWResponse <bool> >(result.Content).Data; if (res) { this.dataGridView1.Rows.Remove(this.dataGridView1.SelectedRows[0]); } } } }