mvc
@helper ShowTree(IEnumerable<Admin.Models.PagesCategory> categories)
{
foreach (var item in categories)
{
<td><input type="checkbox" value="@item.Pcatid" name="deleteid" class="input-chk"></td>
<td>
@item.PcatTitle
@if (item.PagesCategory1.Any())
{
@ShowTree(item.PagesCategory1)
}
</td>
<td>
<div class="badge badge-warning">@item.Status.StatusName</div>
</td>
<td class="text-right">
<a href="@Url.Action("PageCategoryEdit", "Page", new { Bannerid = item.Pcatid })" class="btn btn-primary"><i class="fa fa-pencil"></i></a>
</td>
}
我怎样才能用foreach转换? 我怎么能这样做