protected void bntAdd_Click(object sender, EventArgs e) { pet = new Pet(); pet.Nome = nome_txt.Text.Trim(); pet.Altura = double.Parse(altura_txt.Text.Trim()); pet.Peso = double.Parse(peso_txt.Text.Trim()); pet.Animal.Codigo = int.Parse(listAnimais.SelectedValue); pet.Cliente.Codigo = int.Parse(IDCliente.Text.Trim()); if (controleCliente.InsertPet(pet) > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Pet cadastrado com sucesso!')", true); } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Não foi possível cadastrar esse Pet!')", true); } }