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