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
  • 58,060
  • 25
  • 98
  • 150
Noah R
  • 5,287
  • 21
  • 56
  • 75

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
  • 1,023,142
  • 271
  • 3,287
  • 2,928