Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

exclude specific block on the contentarea when rendering

Vote:
 

The content area property allows two types of blocks. One of the block has got icon in it's partial view.
When I render the content area property in the following way, I am missing that icon on the block.

Is there anyway to exclude the block type in the contentarea when rendered on the view so that I can render the block type with icon separately as a partial view?

Model:
[CultureSpecific]
[Display(
Name = "Response",
GroupName = SystemTabNames.Content,
Order = 30)]
[AllowedTypes(new[] { typeof(Block2), typeof(Block1) })]
public virtual ContentArea ResponseContentArea { get; set; }

View:
@Html.PropertyFor(m => m.CurrentPage.ResponseContentArea)

#162236
Oct 13, 2016 12:44
Vote:
 

One option would be to implement a custom contentarea renderer as per the following blog post: http://joelabrahamsson.com/custom-rendering-of-content-areas/

Otherwise you can always get the items in the contentarea by using the Contents property (ContentArea.Contents): http://world.episerver.com/documentation/class-library/?documentId=cms/7/ab3bbfb1-5fdd-6650-3ebf-5e59f8f98490

#162237
Oct 13, 2016 12:51
Vote:
 

How about using tags to render, and only have a renderer for the tag for one of the block types?

#162791
Oct 15, 2016 14:21
* 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.