I am working with a repeater and want to put a specific class attribute in the Container Before property for the "UL" tag depending on the number of child documents of a specific type. How can I in a K# macro for the Container Before property of the repeater, get the count of child documents of a specific type?
<%# Eval("NodeChildNodesCount") %> Would give you the count of the child nodes.
Or write a custom function where you would feed the "NodeChildNodesCount" and the Document type (probably Class ?"). This would be the easiest.
You might look into using a hierarchical viewer as well. This can handle those hierarchy items much more gracefully than a standard repeater.
Turns out it was easier to write it as part of the transformation and use a Text/XML transform instead of an ASCX and use K#:
Sorry code did not wrap propertly
{% if (DataItemCount == 1 && DataItemIndex == 0 ) { return "<ul class=\"single\">" } |(identity)GlobalAdministrator%}</span></a></li>
Please, sign in to be able to submit a new answer.