I am doing this but could not figure out the linqy way to do it:
<umbraco:macro runat="server" language="razor"> @using umbraco.MacroEngines @{ dynamic node = new DynamicNode(1117); var featured = node.Children; } @foreach(var page in featured) { if(@page.featured){ @page.Id<br/>@page.featured } } </umbraco:macro>
I am on home page and page 1117 is of type PortfolioFolder that has bunch of children of type Portfolio that has property alias Featured i wanna list if that is set to true. My dirty code above works but its not very elegant.
List children with select
Razor gurus,
I am doing this but could not figure out the linqy way to do it:
<umbraco:macro runat="server" language="razor">
@using umbraco.MacroEngines
@{
dynamic node = new DynamicNode(1117);
var featured = node.Children;
}
@foreach(var page in featured) {
if(@page.featured){
@page.Id<br/>@page.featured
}
}
</umbraco:macro>
I am on home page and page 1117 is of type PortfolioFolder that has bunch of children of type Portfolio that has property alias Featured i wanna list if that is set to true. My dirty code above works but its not very elegant.
Whats the proper way of doing it.
Regards
Ismail
I think this should do it (not tested):
@Rick - that looks right.
Future blog post on umbraco.com will cover .Where
is working on a reply...