protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e) { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridView3.Rows[index]; int id = Convert.ToInt32(row.Cells[0].Text); String cliente = Convert.ToString(row.Cells[1].Text); String peca = Convert.ToString(row.Cells[2].Text); String ididstring = Convert.ToString(row.Cells[0].Text); var db = new VendaDB(); if (e.CommandName == "EXCLUIR") { db.Delete(id); LoadGrid(); } else if (e.CommandName == "ALTERAR") { Venda venda = db.SelectById(id); txtID3.Text = ididstring; DropDownList1.Text = cliente; DropDownList2.Text = peca; txtDescricao.Text = venda.Descricao; } }
protected void GVVenda_RowCommand(object sender, GridViewCommandEventArgs e) { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = GVVenda.Rows[index]; int id = Convert.ToInt32(row.Cells[0].Text); var db = new VendaDB(); if (e.CommandName == "EXCLUIR") { db.Delete(id); LoadGrid(); } else if (e.CommandName == "ALTERAR") { Venda venda = db.SelectById(id); txtDescricao.Text = venda.Descricao; txtModelo.Text = venda.Modelo; txtPreco.Text = venda.Preco; txtIdCliente.Text = venda.Cliente; txtIdFuncionario.Text = venda.Funcionario; } }