I am sure this could be better but this is working for me. I only have a couple roles setup so an if condition like this isn't much trouble.
foreach(var person in people){
var roles = person.Value<IEnumerable<string>>("memberRoles");
foreach(var role in roles){
if(role == "Site Selection"){
<h2>@person.Name</h2>
}
}
}
There is probably a more elegant way to to this, but I am at least getting the results I want:
var team = Umbraco.Content(Guid.Parse("123456789"))
.ChildrenOfType("teamMember")
.Where(x => x.IsVisible());
@foreach(var item in team) {
foreach(var g in item.Value<IEnumerable<string>>("group")) {
if( g == "foo" ) {
<p>@item.Value("yourField")</p>
}
}
}
If anyone has an improved response, I'd like to see it.
check specific checkbox list value
I have a checkboxlist in v8, and i need to check it for values and do something, if a specific checkbox is set...
Iknow i can get the values by doing
But how do i check if one of the values is "foo"?
I am sure this could be better but this is working for me. I only have a couple roles setup so an if condition like this isn't much trouble.
There is probably a more elegant way to to this, but I am at least getting the results I want:
If anyone has an improved response, I'd like to see it.
Try:
is working on a reply...