Razor - how to list descendants from multiple lists
I'm trying to create a macro to list descendants of a particular document type no matter where they are in the content tree. At the moment it only traverses through the first list (in this instance the UG study list) but I need it to travel both lists:
-Main ---UG study (programmeList) ......programme 1 ......programme 2 ---PG study (programmeList) ......programme 1 ......programme 2
How do I get it to get any document types not just from the first list?
@using umbraco.MacroEngines @inherits DynamicNodeContext @{ string schoolToFind = Parameter.ProgrammeSchool; var root = Model.AncestorOrSelf(); var programmeNames = root.Descendants("ProgrammeList").First();
<div> @foreach (var item in programmeNames.Children.OrderBy("programmeName")) { string[] school = item.school.ToString().Split(',');
if (school.Contains(schoolToFind)) { <li> <a href="@item.Url">@item.programmeName - @item.qualificationType</a> </li> }
Razor - how to list descendants from multiple lists
I'm trying to create a macro to list descendants of a particular document type no matter where they are in the content tree. At the moment it only traverses through the first list (in this instance the UG study list) but I need it to travel both lists:
-Main
---UG study (programmeList)
......programme 1
......programme 2
---PG study (programmeList)
......programme 1
......programme 2
How do I get it to get any document types not just from the first list?
Hi,
I changed your code. Now the query will get all doctype Programme
Thank you so much it works now :)
is working on a reply...