mvc无限类别列表

时间:2018-06-11 07:39:52

标签: model-view-controller categories

列出无限类别时

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转换? 我怎么能这样做

0 个答案:

没有答案