For what you're trying to do, @Html.RenderAction(..)
is the correct call. RenderAction
is ChildActionExtension
and will need to add that attribute to the controller.
Your controller should look something like below. Note that you will want to return a PartialView as well.
[ChildActionOnly]
public ActionResult Navigation()
{
var pages = pageRepository.Pages;
return PartialView(pages);
}
The Render action does not return HTML, but rather adds the content to the response. With that, your view should look like:
@{@Html.RenderAction("Navigation", "Nav");}
Reference: http://msdn.microsoft.com/en-us/library/ee721274(v=vs.108).aspx