Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Adding a counter within a repeater's transformation code View modes: 
User avatar
Member
Member
toddr-atlas-advertising - 8/9/2012 3:50:29 PM
   
Adding a counter within a repeater's transformation code
Is there a way to add a counter within a transformation? I would like to add some code to my transformation every 3rd pass. Is this something that is possible?

Thanks
Todd

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/10/2012 1:34:44 PM
   
RE:Adding a counter within a repeater's transformation code
Yes it is very possible. You can access the Index of the current item with the DataItemIndex property.


// Since the DataItemIndex is zero based, add 1 to it before you do modulus 3 or else the 4th item will be the first to be marked. If you want the 1st item to be marked as well as every third, then don't add 1 to it.
<%# (DataItemIndex +1 %3 == 0)?”A third Record”:”Not a third record” %>