为什么Html.Action第二次调用失败?

时间:2019-04-17 13:57:20

标签: asp.net asp.net-mvc razor partial-views

我在ProjectAuthorityController上有此操作方法:

[Authorize]
[HttpGet]
public ActionResult BoqReview(Guid projectId)
{
    var model = GetReviewModel(projectId);
    return PartialView("_BoqReviewPartial", model);
}

然后在我的主视图BoqUpload中,我具有以下Razor元素:

@Html.Action("BoqReview", "ProjectAuthority", new { projectId = Model.ProjectId })

当我的BoqUpload视图再次呈现时,在BoqUpload POST操作完成之后,我在@Html.Action元素上收到以下错误:

A public action method 'BoqReview' was not found on controller 'ITIS.Web.Modules.ProjectAuthority.Controllers.ProjectAuthorityController'.

现在,该视图如何在第一次渲染而不是第二次找到公共方法“ BoqReview”?

1 个答案:

答案 0 :(得分:0)

尝试删除[HttpGet]批注

[Authorize]
public ActionResult BoqReview(Guid projectId)
{
    var model = GetReviewModel(projectId);
    return PartialView("_BoqReviewPartial", model);
}