Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

How to get parent block inside content area


I have SearchContainerBlock with ContentArea containing SpecificSearchBlocks.
SpecificSearchBlock can also be placed outside the container (it is a shared block).

When I try to detect if SpecificSearchBlock is inside ContentArea of SearchContainerBlock, based on ParentLink I get EPiServer.Core.ContentAssetFolder object.

I’ve tried different methods, but every time end up receiving the same type.

Used methods:

Using IContentSoftLinkRepository also didn’t work.

This block is shared among multiple places, and that might be the cause of getting this type of object.

How can I get real parent block type? Should I get it somehow from ContentAssetFolder?

Sep 25, 2018 16:40

Hi Tomasz, just partly answering your question. The behavior you get is correct as the container block is not the parent of the shared block but the content folder where the block is created (blocks panel).

If you think for a moment, when you create a block and drag and drop it to multiple content areas - it is still the one instance of the block in the content areas, so how could the parent (parent link) of a block be all those content areas it is dropped in? Nope it can't.

Anyways if you search the world forums or use google, you will find some semi-working ways to find the containing content, but most likely the answer would be "You are doing it wrong, if you need to know the parent".

Sep 25, 2018 20:44

This might help you

Sep 26, 2018 8:15


I understand the behaviour but sometimes information about the shared block rendering context could be useful.

@Johan, thanks. I have already went through some articles (this also) but all the solutions seems to be a little bit hacky - thus I have asked if there is any official support for retrieving relevant information.

Sep 26, 2018 8:29
* 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.