我有Ajax.BeginForm的問題。我有一個表單提交和更新部分視圖的按鈕。從同一動作返回重定向或部分視圖
我想完成的是我可以在同一個Action中使用下面的返回語句。
// button activates this
return PartialView("PartialViewName", data);
和
// submit activates this
return Redirect(model.Url);
現在的問題是,重定向會導致問題的Ajax.BeginForm
<% using (Ajax.BeginForm("Action", "Controller", new AjaxOptions { OnSuccess = "OnSuccess", UpdateTargetId = "Container", InsertionMode = InsertionMode.Replace }, new { id = "eventAjaxForm" })) { %>
如何才能辨別是結果PartialView,還是我們重定向用戶?