I'm trying to filter a list of projects by categories from a checkbox data type list. Is this possible by just filtering through by text value of the checked item? I've done something similar in the past with radio buttons where (filtered by prevalues actually) but the same code doesn't seem to work for checkboxes.
Been running in circles trying to get this work so any help is greatly appreciated. Thx!
var projects = Model.AncestorOrSelf().Descendants("projectDocType");
foreach(var item in projects.Where("Category.ToString().Contains(\"CategoryTextToFilter\")"))
{
<p><a href="@item.Url">@item.Name</a></p>
}
filtering by checkbox U4.11
I'm trying to filter a list of projects by categories from a checkbox data type list. Is this possible by just filtering through by text value of the checked item? I've done something similar in the past with radio buttons where (filtered by prevalues actually) but the same code doesn't seem to work for checkboxes. Been running in circles trying to get this work so any help is greatly appreciated. Thx!
Hi Melanie,
It looks like you need to use id of "CategoryTextToFilter", becaue field is storing id of string, not text.
Thanks,
Alex
Hi Melanie,
Did you find solution?
Hi Alex,
Yes, thanks for checking, I sort of got it to work like so:
Using Id like you suggested didn't work for me unfortunately. I think that only works with the radiobutton data type.
Glad that this topic is solved!
Have a good day, thanks for sharing code!!!
is working on a reply...