我有这个视图,其中包含以下代码:
@model ComPost.Core.CommandsAndQueries.Contract.DataContract.DepositDetailDTO
@section scripts
{
<script src="~/Scripts/DataTables-1.9.4/media/js/jquery.dataTables.js"></script>
<script src="~/Scripts/jquery.datatables.bootstrap-pagination.js"></script>
<script src="~/js/DepositDetail.js"></script>
}
@Html.RenderAction(new { Action = "DepositDetailOverview", Controller = "Deposit" }, new { id = @Model.Id })
我的控制器有以下代码:
public ActionResult DepositDetail(int id, int tabIndex = -1)
{
ViewBag.DepositId = id;
ViewBag.ActionMethodForPartialView = this.GetControllerActionForTabIndex(tabIndex);
DepositDetailDTO depositDetailDTO = this.QueriesServiceAgent.Call(s => s.GetDepositDetailForId(id));
return View(depositDetailDTO);
}
public PartialViewResult DepositDetailOverview(int id)
{
ViewBag.DepositId = id;
DepositOverviewScreenDTO depositOverviewScreenDTO = this.QueriesServiceAgent.Call(s => s.GetDepositOverviewForId(id));
return PartialView(depositOverviewScreenDTO);
}
private string GetControllerActionForTabIndex(int tabIndex)
{
if (tabIndex <= 0)
{
return "DepositDetailOverview";
}
else if (tabIndex == 1)
{
return "DepositMailingLists";
}
return "DepositFinalize";
}
当我们进入 DepositDetail 屏幕时,我们调用控制器上的“DepositDetail”方法。这会调用 helper-method,该方法返回要调用的操作的名称以获取局部视图。
我似乎无法让它工作。我错过了什么?