How to filter a node by Checkbox List in Umbraco 11
Hi,
In my Umbraco 7 website I have nodes which have few categories.
Every time I add a new item to a node with mix categories, I select the category of this item. Then, when I want to display the magazine archive, I filter the node by the specific category, so I only display the items from a specific category.
But I'm suggesting to use the models builder, which is quite easy to configure, and it will generate strongly typed models, which will give intellisense in code editor tools(vscode,visual studios.. etc) and give a better understanding about the return type.
How to filter a node by Checkbox List in Umbraco 11
Hi,
In my Umbraco 7 website I have nodes which have few categories.
Every time I add a new item to a node with mix categories, I select the category of this item. Then, when I want to display the magazine archive, I filter the node by the specific category, so I only display the items from a specific category.
In my Umbraco 7 the code looks as follow:
etc.
In my Umbraco 11 I tried to do the following, but I'm getting an empty node:
Why I'm not getting the news items that matching the checkbox for each news item?
Thanks
Hi Meni,
n.Value("OpliCategory") == "Lasers")
the n.Value is return the type object , and here you match with a value that is stringLasers
!Please cast the value to string and then try to check the conditions.
n.Value("OpliCategory")?.ToString()== "yourvalue")
But I'm suggesting to use the models builder, which is quite easy to configure, and it will generate strongly typed models, which will give intellisense in code editor tools(vscode,visual studios.. etc) and give a better understanding about the return type.
Ref: Models Builder
Dhanesh
Hi, thanks.
Didn't work. It seems it returns an array.
So what I did is the following:
and now it's working.
Thanks anyway for your help!
is working on a reply...