Questions tagged «asp.net-mvc-ajax»

14
如何获得ASP.NET MVC Ajax响应以重定向到新页面,而不是将视图插入UpdateTargetId?
我正在使用Ajax.BeginForm创建一个表单,该表单将ajax回发到某个控制器操作,然后,如果操作成功,则用户应重定向到另一个页面(如果操作失败,则使用AjaxOptions UpdateTargetId)。 using (Ajax.BeginForm("Delete", null, new { userId = Model.UserId }, new AjaxOptions { UpdateTargetId = "UserForm", LoadingElementId = "DeletingDiv" }, new { name = "DeleteForm", id = "DeleteForm" })) { [HTML DELETE BUTTON] } 如果删除成功,我将返回重定向结果: [Authorize] public ActionResult Delete(Int32 UserId) { UserRepository.DeleteUser(UserId); return Redirect(Url.Action("Index", "Home")); } 但是Home Controller Index视图已加载到UpdateTargetId中,因此我最终在页面中找到一个页面。我在考虑两件事: …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.