【问题标题】:Why is PartialView not called when being called from another ActionResult method?为什么从另一个 ActionResult 方法调用时不调用 PartialView?
【发布时间】:2013-11-02 07:37:49
【问题描述】:

我正在使用 MVC4。 我有一个返回 ActionResult 的 [HttpPost] 控制器方法。 在这个函数中,当我捕获一个异常时,我的计划是调用一个返回 PartialView("ExceptionMessage", exceptionObject) 的 [ChildActionOnly] ActionResult 方法。 ExceptionMessage.cshtml 基本上使用完整的 Exception 对象呈现标记。

现在由于某种原因,当调用此 PartialView 时,.cshtml 中的断点没有被命中。

为什么这不起作用?

【问题讨论】:

    标签: asp.net-mvc-3 asp.net-mvc-4 partial-views actionresult


    【解决方案1】:

    这是我的用户错误。 当控制器方法返回时调用视图,从而有机会渲染 cshtml。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-03
      • 1970-01-01
      • 2023-01-13
      • 1970-01-01
      • 2010-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多