次の方法で Parent.cshtml ビューで呼び出される _Partial.cshtmlビューがあります。
親.cshtml:
@Html.Render("_Partial");
_Partial.cshtmlビューには、次の方法でフォームにリンクされたボタンがあります。
using (Html.BeginForm("Send", "DetailsController", FormMethod.Get))
{
<input type="submit" value="submit" />
}
DetailsControllerには、次のようなSendアクションがあります。
public ActionResult Send(int orderId)
{
if (some condition)
{
return RedirectToAction(parentAction, parentController, new {orderId});
}
return RedirectToAction(action, controller, new {orderId});
}
私が抱えている問題は、ParentActionViewContextが null であることです。
部分ビューの親コントローラー名を取得するにはどうすればよいですか?