I have a controller in the shared path
\controller\blah.cs
that a partial view is talking to
\views\shared\SomeDir\blah.cshtml
All is good except when I try to make a @Html.Action
link that gets to that shared controller:
@Html.Action("MethodName", new { Area = "Whatever", Controller = "Blah" });
works of course but finds the controller in
\Areas\Blah\Controller\Blah.cs
which is NOT what I want.
@Html.Action("MethodName", new { Area = "", Controller = "Blah" });
does not work either.
@Html.Action("MethodName", new {Controller = "Blah" });
does not work either.
Anybody know the right way to get the @Html.Action
to route to the controller in the root i.e.
\controller\
instead of the current area?
I believe you want this overload of the Html Helper
public static MvcHtmlString Action(this HtmlHelper htmlHelper, string actionName, string controllerName, object routeValues);
So using your example, you would have:
@Html.Action( "MethodName", "Blah", new { Area = "" });