Skip to content

Instantly share code, notes, and snippets.

@thinkt4nk
Created March 21, 2011 15:23
Show Gist options
  • Save thinkt4nk/879616 to your computer and use it in GitHub Desktop.
Save thinkt4nk/879616 to your computer and use it in GitHub Desktop.
<%
Action<System.Data.DataTable, int> printCategoriesRecursively = null;
printCategoriesRecursively = (System.Data.DataTable categoryRows, int depth) => {
if (categoryRows==null || categoryRows.Rows.Count==0) return;
%>
<ul class="node-list depth-<%=depth%>">
<%
foreach (System.Data.DataRow CategoryRow in categoryRows.Rows) {
%>
<li>
<%=CategoryRow["categoryCode"]%>
<% BAL.Category Category = new BAL.Category((String)CategoryRow["categoryCode"]); %>
<%printCategoriesRecursively(Category.getChildren(), depth + 1);%>
</li>
<%
}
%>
</ul>
<%
};
printCategoriesRecursively(TopLevelCategories, 0);
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment