Question with MVC Partial view where() filtering syntax for array
I'm trying to filter out results in a foreach loop (umbraco7 MVC rendering partial view). I've been using individual checkboxes for the datatype objects I'm pulling in, and that seems to work but doesn't look great for the content editors. So they currently check individual checkboxes for an item. In this example say a site asset can be checked as value1, value2, value3 and so on.
Then in the for each loop I am filtering out using the following:
@foreach (var myItem in myNode.Children.Where("Visible").Where("value1 == true")) { <li>@myItem.name</li> }
This works but I'd like to switch from individual checkboxes for each value to a multiselect list or checkbox list. this obviously creates an array of values. My Problem is that I just can't figure out the syntax in the foreach loop to say that it contains the values I'm looking for...Hope this question makes sense.
I'd like to do something like below but am obviously not clear on the syntax or how to accomplish this. Searching an array for a value rather than just checking if a boolean is true or not.
@foreach (var myItem in myNode.Children.Where("Visible").Where("myCategories 'contains' value1")) { <li>@myItem.name</li> }
Question with MVC Partial view where() filtering syntax for array
I'm trying to filter out results in a foreach loop (umbraco7 MVC rendering partial view). I've been using individual checkboxes for the datatype objects I'm pulling in, and that seems to work but doesn't look great for the content editors. So they currently check individual checkboxes for an item. In this example say a site asset can be checked as value1, value2, value3 and so on.
Then in the for each loop I am filtering out using the following:
This works but I'd like to switch from individual checkboxes for each value to a multiselect list or checkbox list. this obviously creates an array of values. My Problem is that I just can't figure out the syntax in the foreach loop to say that it contains the values I'm looking for...Hope this question makes sense.
I'd like to do something like below but am obviously not clear on the syntax or how to accomplish this. Searching an array for a value rather than just checking if a boolean is true or not.
is working on a reply...