protected void Btn_Edit_Click(object sender, EventArgs e) { UserInfo userInfo = new UserInfo { Uid = txt_Id.Text.Trim(), UPwd = txt_pwd.Text.Trim() }; bool result = false; try { result = adminManager.AddAdminUser(userInfo); if (result) { Response.Write("<script>alert('添加成功');</script>"); Server.Transfer("UserList.aspx"); } } catch { if (!result) { Response.Write("<script>alert('添加失败,用户名重复!');</script>"); } } }