I have a base controller all my other controllers inherit from, inside the base controller are 2ActionResult that is common to every page on my site. When I try to use Html.RenderAction to call either of these actions from a View I get the error
No route in the route table matches the supplied values.
I have checked and the Action is set to public and the names are spelled right. What am I doing wrong?
The call: @{ Html.RenderAction("SectionNavigation"); }
The Action:
[Route("SectionNavigation")]
public ActionResult SectionNavigation()
As you can see I am also using Attribute Routing as well. I also tried updated the call to specify Base as the controller but that did not change anything.
The first parameter of the
RenderActionmethod is the action name, not the route name.If you're rendering a View that is being generated using a Controller other than the one that defines the
SectionNavigationAction, you'll have to specify the Controller name as well:If you're using Areas, you'll have to include the Area name as well:
See Documentation