protected void btnGrabar_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text.Trim().Length < 1)
            {
                Response.Write("<script>alert('Falta Nombre');</script>");
                txtNombre.Focus();
                return;
            }
            formapago.Id = 0;
            if (txtId.Value.Trim().Length > 0)
            {
                formapago.Id = Int32.Parse(txtId.Value);
            }
            formapago.Nombre = txtNombre.Text;
            formapago.Activo = chkActivo.Checked;

            if (formapago.existe())
            {
                Response.Write("<script>alert('Ya esta en la BDD');</script>");
                txtNombre.Focus();
                return;
            }
            int res = formapago.grabar();

            // si hay error avisa al usuario
            if (res < 0)
            {
                Response.Write("<script>alert('Error en la BDD');</script>");
            }
            else
            {
                btnLimpiar_Click(null, null);
            }
        }