The problem i have is that when i use @Html.RenderAction or @Html.Action in the Layout and call Action method from Controller page is not displaying at all. But when i use static attributes in layout all works fine.
Layout:
<li>
<a href="#"><i class="fa fa-fw"></i> Category<span class="fa arrow"> </span></a>
<ul class="nav nav-second-level">
@{
Html.RenderAction("Category","Home");
}
</ul>
</li>
Action Method:
public ActionResult Category()
{
int memberId = WebSecurity.GetUserId(User.Identity.Name);
return PartialView("_Categories", _db.Query<Category>().ToList().Where(u => u.UserId == memberId));
}
PartialView:
@model IEnumerable<PasswordCloudApp.Models.Category>
@{ Layout = "~/Views/Shared/_Layout.cshtml"; }
@foreach (var item in Model)
{
<li>
@Html.ActionLink(item.Name, "Index", "Entry", new { id = item.Id }, null)
</li>
}
I've tried just with regular view, then with partial view, none of it works. Any suggestion?