Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试做一些我认为很明显的事情,但是我找不到关于此的文档来挽救我的生命.. 基本上,我想为一个页面的所有子页面的名称建立一个链接列表.. 我我正在尝试这个没有运气.. 有没有简单的方法来完成这个?
@foreach (var page in Model.Content.Where(page => page.Name.Equals("About")).Children) { <a href="">...</a> }
如果你的意思是你想要链接到当前页面的名为“关于”的孩子,那么你可以这样做:
@foreach(var page in @Model.Content.Children.Where(x => x.Name == "About")) { <a href="@page.Url">@page.Name</a> }