Just getting started in trying to figure Umbraco and MVC out, so I appreciate your patience in advance.
I have a partial view that is loading lesson plans. The lesson plan document Type has a Checkbox list that specifies an age range (Early Elementary, Late Elementary, etc...). I'd like to be able to list out specific age ranges for ease of consumption (i.e. first list is only Early Elementary, second is Late Elementary, etc...). Would this be best accomplished in the 'Where' clause of the loop? Is there a good example of syntax for listing by checkbox list value? Thanks!
Hi Seth.
In my case for such purposes (with ranges) I have created custom property using Umbraco.DropDown with alias rangeproperty. And you insert predifined values: like alabama, oklahoma, etc.
And filtering according to those values goes something like this:
Thanks so much for your response! I am not having much luck though - chock it up to general inexperience on my part.
The alias of my checkbox list is "ageRange" - so I was assuming it would look like this. Is something glaringly wrong with what you see below? would it be different syntax for a checkbox list?
Filtering Data by custom data type
Just getting started in trying to figure Umbraco and MVC out, so I appreciate your patience in advance.
I have a partial view that is loading lesson plans. The lesson plan document Type has a Checkbox list that specifies an age range (Early Elementary, Late Elementary, etc...). I'd like to be able to list out specific age ranges for ease of consumption (i.e. first list is only Early Elementary, second is Late Elementary, etc...). Would this be best accomplished in the 'Where' clause of the loop? Is there a good example of syntax for listing by checkbox list value? Thanks!
Seth
Hi Seth. In my case for such purposes (with ranges) I have created custom property using Umbraco.DropDown with alias rangeproperty. And you insert predifined values: like alabama, oklahoma, etc.
And filtering according to those values goes something like this:
Where("Visible && rangeproperty.Contains(@0)","alabama")
Hope that helps. Ivan
Thanks so much for your response! I am not having much luck though - chock it up to general inexperience on my part.
The alias of my checkbox list is "ageRange" - so I was assuming it would look like this. Is something glaringly wrong with what you see below? would it be different syntax for a checkbox list?
}
I dont know how it goes for checkboxlist, why dont you change your variable to dropdown and code should work for you.
EDIT:
seems like you have extra " in your where statement, right at the end:
"Visible && ageRange.Contains(@0)","Early Elementary" "
Try putting this in where() "Visible && ageRange.Contains(@0)","Early Elementary". Following logic worked for me.
is working on a reply...