protected void btnSalvar_Click(object sender, EventArgs e) { var Teste = new Teste(); try { if (txtId.Text != "") { Teste.IDTeste = int.Parse(txtId.Text); Teste.Get(); } Teste.Descricao = txtDescricao.Text; Teste.Oliveira = txtOliveira.Text; Teste.Assi = int.Parse(txtAssi.Text); Teste.Save(); GetTeste((int)Teste.IDTeste); Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('Registro salvo.')</script>"); } catch (Exception err) { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('" + FormatError.FormatMessageForJAlert(err.Message) + "')</script>"); } }