예제 #1
0
 protected void btnEnviar_Click(object sender, EventArgs e)
 {
     try
     {
         Contacto contacto = new Contacto();
         contacto.email            = txtCorreo.Text;
         contacto.nombre           = txtNombre.Text;
         contacto.primer_apellido  = txtApellido1.Text;
         contacto.segundo_apellido = txtApellido2.Text;
         contacto.sugerencia       = txtSugerencia.Text;
         ContactoControlador.CrearContacto(contacto);
         ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Mensaje enviado');", true);
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert(\"" + ex.Message + "\");", true);
     }
 }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     lstContactos.DataSource = ContactoControlador.ObtenerContactos();
     lstContactos.DataBind();
 }