How to include child nodes in determining which pages has a dropdown value?
In regards to the third example described here for dropdowns. How can we expand the following code to include child nodes that have dropdown values assigned to them?
@{
var valueToMatch = "SuperMan";
//Get the first node inside the root
var firstTypedContentAtRoot = Umbraco.TypedContentAtRoot().FirstOrDefault();
if (firstTypedContentAtRoot != null)
{
var articles = firstTypedContentAtRoot.Children.Where(x => x.HasValue("superHero") && x.GetPropertyValue<string>("superHero").ToLower().Contains(valueToMatch.ToLower()));
if (articles.Any())
{
<p>Pages with @valueToMatch selected:</p>
<ul>
@foreach (var page in articles)
{
<li><a href="@page.Url"> @page.Name</a></li>
}
</ul>
}
}
}
For example, in the starter kit of Umbraco 7.6.6,
I modified my content page document type to include a dropdown with 4 pre-defined values.
I then assigned the About Us and About this Starter Kit content nodes with the dropdown value "Jacket".
FYI - Both the About Us and About this Starter Kit content nodes share the same document type.
...But with the above code, Umbraco only recognizes the About Us with the value Jacket.
How to include child nodes in determining which pages has a dropdown value?
In regards to the third example described here for dropdowns. How can we expand the following code to include child nodes that have dropdown values assigned to them?
For example, in the starter kit of Umbraco 7.6.6,
content page
document type to include a dropdown with 4 pre-defined values.About Us
andAbout this Starter Kit
content nodes with the dropdown value "Jacket".FYI - Both the
About Us
andAbout this Starter Kit
content nodes share the same document type....But with the above code, Umbraco only recognizes the
About Us
with the value Jacket.Any thoughts?
is working on a reply...