Search code examples
c#asp.netvb.netwebformsrepeater

Is there a similar way to AlternateItemTemplate to do this


I know that with a repeater I can use AlternatingItemTemplate and SeparatorTemplate to adopt a variety of alternating items or for the latter a consistent style / attribute between items.

But in my latest task, I require a SeperatorTemplate but only after every 3 items!

I know I can do this in the ItemDataBound and have a cheeky runningItemCount++ then use runningItemCount % 3 == 0 to place this in.

I also know I can do this using a repeater within a repeater. Just mentioning it is dirty....

I want to keep things clean to be honest, and if it's built in then it's something I want to get in the habit of using, so if anyone knows of how to do so in a nice way (no workarounds please), then please intrigue me.


Solution

  • From looking in to this issue in various areas the conclusion in a nut shell is 'No there isn't'.

    I had to use the method I mentioned as unfortunately there is no specific built in feature for this functionality.