protected void btn_excluir_Click(object sender, EventArgs e) { try { Class_Remedio remedio = new Class_Remedio(); remedio.cod_remedio = int.Parse(tbl_codRemedio.Text); remedio.excluir(); GridView1.DataSource = remedio.visualizar(); GridView1.DataBind(); } catch (Exception ex) { Response.Write(ex.Message); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { Class_Remedio remedio = new Class_Remedio(); remedio.cod_remedio = Convert.ToInt32(e.Values[0]); remedio.excluir(); GridView1.EditIndex = -1; GridView1.DataSource = remedio.visualizar(); GridView1.DataBind(); } catch (Exception ex) { Response.Write(ex.Message); } }