OK new to MVC. I had asked this question earlier and got an answer but I am wondering if there is a simpler solution.
Say I have a master page with a menu laid out as an
stephen,
here's my contribution to the party. a recursive inline function to populate the
for as many depths as is required (here's the entire ascx file):
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl>" %>
<%@ Import Namespace="GBC_Art.Controllers" %>
<%
Action, int> printNodesRecursively = null;
printNodesRecursively = (List nodeList, int depth) =>
{
if (nodeList == null || nodeList.Count == 0) return;
%>
nodes = Model;
printNodesRecursively(nodes, 0);
%>
<%
};
List
usage -> called as a partialview via the controller as per your example above.
cheers