示例#1
0
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            try
            {
                Rol rol = new Rol(TxtNombre.Text, TextDescripcion.Text);
                rol.Insertar();

                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('el rol ha sido creado exitosamente');" +
                                                    "window.location ='Role_Admin.aspx';", true);
            }
            catch (Exception ex)
            {
                Session["mensajeError"] = "Ha ocurrido un error al crear el rol. " + ex;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('NO DEBE HABER CAMPOS VACÍOS');", true);
            }
        }