If I use the following controller method:
public ActionResult Menu()
{
return PartialView("viewName", navLinks);
}
calls a partial view in _Layout.cshtml as follows:
<div id="categories">
@{ Html.Action("Menu", "Nav"); }
</div>
With the following partial view of ASCX:
<%@ Control Language="C#"
Inherits="ViewUserController<IEnumerable<MyDataType>>" %>
<% foreach(var link in Model) { %>
<%: Html.Route.Link(link.Text, link.RouteValues) %>
<% } %>
everything is working fine. Yay
BUT if I use any of the following partial RAZOR views:
@model IEnumerable<MyDataType>
@foreach(var link in Model){
Html.RouteLink(link.Text, link.RouteValues);
}
or...
@model IEnumerable<MyDataType>
@{
Layout = null;
}
@foreach(var link in Model){
Html.RouteLink(link.Text, link.RouteValues);
}
I get nothing. there is no exception, I just don't get anything. I know that the problem is not with the controller method (it works fine with the partial ASCX representation).
What's going on here?
source
share