Display multiple nodes based on doctype with Where clause
Hi everyone,
I'm trying to display certain doctypes from my node tree using the foreach where clause and I'm having difficulty finding the correct syntax. For instance, if I have 10 different doctypes in my site and I want to display every page that has the doctype 'Page1' and 'Page2', what is the best way to achive this? Currently using Umbraco 4.11.10. Here's something I've tried but I recieve the error 'Can only unbox from an object or interface type to a value type':
@{
var r = Model.NodeById(1000);
foreach(var x in r.Children.Where("NodeTypeAlias == Page1 || NodeTypeAlias == Page2")){ <p>@x.Name</p>
}
}
@{
var r = Model.NodeById(1000);
foreach(var x in r.Children.Where("NodeTypeAlias == @0 || NodeTypeAlias == @1", "Page1", "Page2")){
<p>@x.Name</p>
}
}
Display multiple nodes based on doctype with Where clause
Hi everyone,
I'm trying to display certain doctypes from my node tree using the foreach where clause and I'm having difficulty finding the correct syntax. For instance, if I have 10 different doctypes in my site and I want to display every page that has the doctype 'Page1' and 'Page2', what is the best way to achive this? Currently using Umbraco 4.11.10. Here's something I've tried but I recieve the error 'Can only unbox from an object or interface type to a value type':
Cheers,
pronto
Hi Pronto,
You might give this a try:
Further info here
Jeavon
Hi Jeavon,
That's perfect, thank you!
Cheers,
pronto
is working on a reply...