Search code examples
c#asp.netasprepeater

Interrupt repeater to add advertisement and continue with the repeater


Between the comments and blog entries i want to add some stuff to earn some money :D I use

<asp:repeater>
</asp:repeater>

To write out all the blog entries. Is it possible in some way to interrupts the repeater to be able to write out the code for the ad-banner? For example run 3 entries, then add some code for the advertisement and continue with another 3 rows of blog entries? And so on...


Solution

  • It's not possible out-of-the-box, but there is a quite simple workaround.

    Add a Panel in the end of your repeater ItemTemplate, put the ad inside it, and set it's Visible attribute to be "<%# Container.DataItemIndex == 3 %>" or whatever,