Repeated content in a user control

Topics: Developer Forum
Mar 23, 2009 at 11:56 PM

I am new to N2 and am trying to create a user control that will contain a list of custom items that I create, but I can not seem to find documentation on how this can be done.
Basically what I want to do is create a number of items (e.g. paragraphs) and have my user control list all of the ones that are required for the current page.
A paragraph is a custom object that is derived from ContentItem and I have a user control that has the type Paragraph and will display one paragraph.

Can you please point me in the direction of documentation or examples that show this kind of behaviour?


Mar 24, 2009 at 8:38 AM
Basically, you should always keep in mind that a usual ASP.Net tactics will work in N2, that is: at the very least you can put an <asp:Repeater/> at your page's template and render it's children inside it via <ItemTemplate/>. There's also an N2-specific way to accomplish this: you put a <n2:Zone/> control on a page's template, specify a ZoneName attribute for it, then you set the very same value to a ZoneName property of all page's children. The difference between <asp:Repeater/> and <n2:Zone/> is that the latter will render children with their respective templates, so that Zone itself must not care about it's content representation.