Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi to All.
I'm struggling trying to build a query that filters Content by the value of a Property in a Document Type. I need to filter all the items tha have a value selected in a dropdown:
I have tried searching the Forum and in Google, but it looks like I can't Use the GetPropertyValue in Umbraco 8.16.0.
I'm stuck with this:
var content = Umbraco.ContentAtRoot().ToList();
var comunicazioni = Umbraco.Content(Guid.Parse(content.First(x => x.Name == "Comunicazioni").Key.ToString()))
.Where(x => x.IsVisible())
.Where(x => x.GetProperty("tipoComunicazione").ToString() == "NEWS")
.OrderByDescending(x => x.UpdateDate);
Thanks in advance for any help.
You have to Get the value of the stop down.
In the Umbraco v8, you cannot read the dropdown value as a string field.
Then pass it to query.
Hi Rene! I think if you change the x.GetProperty("tipoComunicazione").ToString() to x.Value<string>("tipoComunicazione"), that should make it work!
Thanks a lot!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted