0

So within the layout of my site I've added a RenderAction that looks like this:

@{Html.RenderAction("../Controller/Action", new Site.Models.Controller());}

The control works fine if I point my browser at site.com/Controller/Action but if I try using it within the layout the controller actions aren't executed.

I've also tried:

@{Html.RenderAction("Controller", "Action", new Site.Models.Controller());}
tereško
  • 57,247
  • 24
  • 95
  • 149
Noah R
  • 5,015
  • 21
  • 53
  • 74

1 Answers1

1

You have inverted the parameters. First comes the action name and then the controller name:

@{Html.RenderAction("Action", "Controller", new Site.Models.Controller());}

or the equivalent:

@Html.Action("Action", "Controller", new Site.Models.Controller())
Darin Dimitrov
  • 994,864
  • 265
  • 3,241
  • 2,902