private void DgvProduto_CellContentClick(object sender, DataGridViewCellEventArgs e) { btnCancelar.Enabled = true; btnEditar.Visible = true; btnSalvar.Visible = false; ProdutoNEG negProd = new ProdutoNEG(); idForn = Convert.ToInt32( dgvProduto.Rows[e.RowIndex].Cells[2].Value.ToString()); if (dgvProduto.Columns[e.ColumnIndex] == dgvProduto.Columns[0]) { txtId.Text = dgvProduto.Rows[e.RowIndex].Cells[2].Value.ToString(); cboFornecedor.Text = dgvProduto.Rows[e.RowIndex].Cells[3].Value.ToString(); txtNome.Text = dgvProduto.Rows[e.RowIndex].Cells[4].Value.ToString(); cboQuantidade.Text = dgvProduto.Rows[e.RowIndex].Cells[5].Value.ToString(); txtPreco.Text = dgvProduto.Rows[e.RowIndex].Cells[6].Value.ToString(); txtPeso.Text = dgvProduto.Rows[e.RowIndex].Cells[7].Value.ToString(); txtTamanho.Text = dgvProduto.Rows[e.RowIndex].Cells[8].Value.ToString(); cboCor.Text = dgvProduto.Rows[e.RowIndex].Cells[9].Value.ToString(); } if (dgvProduto.Columns[e.ColumnIndex] == dgvProduto.Columns[1]) { negProd.DvgProd(idForn); MessageBox.Show("Excluido com sucesso!"); } CampoProdutoDataGrid(); }
protected void gvProduto_RowDeleting(object sender, GridViewDeleteEventArgs e) { ProdutoNEG negProd = new ProdutoNEG(); ModProduto modProduto = new ModProduto(); // modf.Id = Convert.ToInt32(e.Keys[0]); negProd.DvgProd(Convert.ToInt32(e.Keys[0])); MessageBox.Show("Dado excluido com sucesso!"); CampoProdutoDataGrid(); }