RouteData.DataTokens["ParentActionViewContext"]中包含了父级视图的相关信息,如路由等
public ActionResult Child()
{
var parentView = RouteData.DataTokens["ParentActionViewContext"] as ViewContext;
//或 var parentView = ControllerContext.ParentActionViewContext;
return View();
}
|
请发表评论