想用委托作导航栏的递归无限级分类
网上的C# aspx的劣例子:
http://blog.zhaojie.me/2009/09/rendering-tree-like-structure-recursively.html
其中委托:
我仿照写的,一直报错
<!--页面定义委托-->
@{Action<List<Category>> RenderCategory = null;}
@{RenderCategory = (categories) => {
if(categories.Count > 0)
{
foreach (var item in categories){
<li><a href="@item.Id">@item.Name</a></li>
}
}
};}
@{RenderCategory(categories);}
</li>
@{Action<List<Category>> RenderCategory = null;} @{RenderCategory = (categories) => { if (categories.Count > 0) { foreach (var item in categories) { @<li><a href = "@item.Id">@item.Name</a></li> } } }; }
少個@
不好意思 ,有其他任务,把这个给忘了, 加@ 下面的这个就报错了