How do I get the RouteData associated with the parent action in a partial view?

后端 未结 1 1016
眼角桃花
眼角桃花 2021-02-14 20:10

In the action for a PartialView, I\'d like to know the RouteData associated with the Parent Action.

This partial view is part of my masterpage template, and I\'d like fo

1条回答
  •  旧巷少年郎
    2021-02-14 21:04

    --edit--

    It looks like off of the ControllerContext (from which ViewContext derives) you can get the ParentActionViewContext:

    ViewContext.ParentActionViewContext.RouteData["controller"]
    

    0 讨论(0)
提交回复
热议问题