protected void grvThuThu_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvr; try { gvr = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); } catch { return; } int index = gvr.RowIndex; if (e.CommandName == "Sua") { ThuThu tt = new ThuThu(); GridViewRow gvrow = grvThuThu.Rows[index]; txtMaThuThu.Enabled = false; txtMaThuThu.Text = HttpUtility.HtmlDecode(gvrow.Cells[0].Text).ToString(); tt = ttbll.LayThuThu(txtMaThuThu.Text); txtDienthoai.Text = tt.DienThoai; txtEmail.Text = tt.DiaChiEmail; txtHovaTen.Text = tt.HoTen; txtGhichu.Text = tt.GhiChu; if (tt.TrangThai) { rdHD.Checked = true; } else { rdKHD.Checked = true; } EditState.Value = "edit"; editType.Value = "edit"; } else if (e.CommandName == "Xoa") { GridViewRow gvrow = grvThuThu.Rows[index]; string id = HttpUtility.HtmlDecode(gvrow.Cells[0].Text).ToString(); idDelete.Value = id; EditState.Value = "delete"; } }
private void dgvDSThuThu_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { int index = dgvDSThuThu.CurrentCell.RowIndex; ThuThu item = thuThuBLL.LayThuThu(dgvDSThuThu.Rows[index]); this.tabPage1.Show(); txtMaThuThu.Text = item.MaThuThu; txtHoTen.Text = item.TenThuThu; if (item.GioiTinh == "Nam") { rbtnNam.Checked = true; } else { rbtnNu.Checked = true; } txtDiaChi.Text = item.DiaChi; txtSDT.Text = item.SoDienThoai; txtCMND.Text = item.SoCMND; }