I have a page with a list element attached. How do I determine the number of items in that list? Can use render tags, asp, or any other technique (so long as it works!)
A:
Apparently, the only way to do this is to loop through the list, counting each item, e.g.
<reddot:cms>
<foreach itemname="testList"
object="Context:CurrentPage.Elements.GetElement(lst_myPages).Value"
countername="listCounter">
</foreach>
</reddot:cms>
The length is then available as:
<%!! Store:listCounter !!%>
Bobby Jack
2009-07-03 10:40:18
Would be great if someone could confirm this (or, even better, come up with a proper way of finding the length!)
Bobby Jack
2009-07-03 10:40:42
+3
A:
Reading the render tags documentation I believe it may be possible to do this in a nicer way
So getting the list Element using this
Context:CurrentPage.Elements.GetElement(lst_myPages).Value
The Value property should return a page collection for list items so you should be able to do
Context:CurrentPage.Elements.GetElement(lst_myPages).Value.Count
Steve Temple
2009-07-09 22:56:14