Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Block with contentarea

Vote:
 

Hello

I'm working in a solution with block-handling derived from the Alloy examples. Ie blocks that adapt in size depending on how many that fits each row.

In order to get a more flexible block layout - not only that they are stacked as small as possible, but that there's maybe one row with 2 blocks and then a row with 4 and so on I thought of this solution:

A block that only contains a contentarea, that are allways full width. So, in the page the editor would add 2 blocks, and then this block, let's call it "BlockContainer". The BlockContainer block would contain 4 blocks.

This works very well, I only have one problem: in edit mode, when I add blocks to the contentarea of my BlockContainer block all the blocks I add are rendered in full width instead of adapting to the width. When I publish and view the page then they are adapted correctly.

Doesn't matter if I add them in forms mode or wysiwyg, they are full with until published.

For clarity, some code:

public class BlockContainer : BlockData
{
	public virtual ContentArea MainContentArea { get; set; }
}

View:

@model BlockContainer
@Html.PropertyFor(x => x.MainContentArea)

So, anyone has a clue why this is happening when editing, and if there is a simple way to overcome this.

And of course, does anyone have a better solution on how to achieve this kind of thing.

Regards
Fredrik

#80645
Jan 28, 2014 13:06
Vote:
 

Damn, after some thinking I came up with a better solution:

I have created a block type called RowBlock. It is set to render only in full width. It doesn't render visible to the end user, in admin mode it renders as a horizontal line.

This is perfect. It can be dragged around. There needs to be only one instance. It works well with scheduled publishing of blocks, without unexpected gaps for instance.

#80655
Jan 28, 2014 16:16
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.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.