I can successfully render content from a different Doc Type using x.ContentType.Alias == "cases"
, however, I also want the ability to use the Multinode Tree Picker so the editor can reorder the results. Inside of my cases Doc Type I have a text field for pageTitle
.
At the moment, my foreach renders the results twice as it looks through the Tree Picker, sees there are two items and then also loops through the foreach()
for the .Alias
where there are two published items.
I thought a way around this would be to add an extra Where()
and compare it to the Name()
of the item in typedMultiNodeTreePicker
but I get an error:
Operator '==' cannot be applied to operands of type 'method group' and 'string'
Any ideas on how I can do this?
Full code:
@{
var typedMultiNodeTreePicker = Model.Value<IEnumerable<IPublishedContent>>("caseStudies");
if (typedMultiNodeTreePicker != null)
{
foreach (var item in typedMultiNodeTreePicker)
{
<a href="@item.Url()" style="font-size:30px;">
@item.Name()
@{
var works = Model.Children().Where(x => x.ContentType.Alias == "cases" && x.ContentType.Name == item.Name());
foreach (var work in works)
{
@work.Value("pageTitle")
<br>
}
}
</a>
}
}
}
Thanks