Three blocks per row from ContentArea

Vote:
 

I'm in my first EPi7 project and probably miss some basic knowlege regarding rendering of ContentAreas and ContentReference.

I have a fairly simple task - I would like to render three "Teasers" on one row. Decided I would use the new EPiServer Blocks for this and created a ContentArea (on PageType model) to hold these. I also created a simple BlockType and BlockControl to for viewing block.

Then I used the:

<EPiServer:Property ID="pArea" PropertyName="TeaserContentArea" runat="server" />

Shows my blocks in one long row.

But what if I want every third block to be shown in new row, which is the simlest way to accomplish this?

  1. Can I iterate threw all blocks in TeaserContentArea.Contents and use Contents <EPiServer:Property ...> on every item, can I make this go threw the normal "rendering process" which will select most suitable template the same way using <EPiServer:Property ...> straight on my TeaserContentArea?
  2. At this time I don't need to show more then three teasers so one alternative was to have three containers on the page. I added three ContentReference properties on my page and tryed to show the blocks using <EPiServer:Property PropertyName="Teaser1" ...> but this only showed the ID (I think) of the Block/Page. Is there a way to get the right template rendered using ContentReference or should I use som other Property type?

I also seen there was a EPiBoost package which extended EPiServer ContentArea rendering with "ItemsPerRow", unfortunately this is made for MVC and I'm using webforms in my project.

I also know the Alloy example project has overwritten the ContentArea rendering and I could probably try to use that as a base but it's far more complicated then what I'm trying to accomplish, is this really the right way to go?

#66071
Feb 19, 2013 14:11
Vote:
 

Hi,

I would recommend looking at/copying the content area rendering from Alloy and remove things you don't need.

Alternatively you could render the content area yourself and render the blocks using an EPiServer:ContentRenderer control but eventhough it may seem like more work at first I think the solution in Alloy is the way to go as you won't be reinventing content area rendering (which included circular reference checks etc), just modifying it.

#66073
Feb 19, 2013 15:09
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.