SaaS CMS has officially launched! Learn more now.

How to find all blocks for current page in ContentArea or XHtmlString based on or inherited from FormContainerBlock


How can I find all blocks that are or inherit from FormContainerBlock for current page in ContentArea or XHtmlString when page is saved? This would include existing pages/blocks OR when a page/block is created. I would like to set a page level property of ScaffoldColumn false.

This will be trigger when the _Layout @Html.RequiredClientResources(RenderingTags.Header) and @Html.RequiredClientResources(RenderingTags.Footer) are added. We don't want to add these unless they are being used. All of our pages are based on _Layout and as such not all will utilize epi Forms.

The tricky part is that a block my have a child block so recurrion might be needed.

Jan 03, 2019 23:25

The point of 

@Html.RequiredClientResources(RenderingTags.Header) and @Html.RequiredClientResources(RenderingTags.Footer)

Is that any scripts that are registered to in components should only be loaded in when they are needed when the RenderBody generates markup and the blocks anyhow so you shouldn't have it loading in all pages. We use this heavily so blocks with specific JS only load where needed. Are you sure everything is setup correctly?

Jan 04, 2019 18:11

Make sure you're using a inherited template with renderbody such as This should if all setup correctly not be loaded scripts unless needed

Jan 04, 2019 18:13
* 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.