Try our conversational search powered by Generative AI!

How to render a content area that is not part of the current page


I am trying to render a content area that is not part of the current page. I have a static class which contains a property which extends type BlockData on which i have a property of type ContentArea. I am using this to store configuration for global data including that for use in my header and footer. 

What I am trying to acheive is render the contents of this content area into a partial view from my main layout. I am trying to do something like the following.

 @{ Html.RenderContentArea(StaticClass.SiteSettings.PageHeader); }

Any help would be greatly appreciated.

Jul 02, 2014 10:40

Hi, usually you need to bind that area to the specific page. Not sure on how this would be done in MVC but for instance you need to make sure that you model is of that specific page. In Webforms I would have use a pagelink property to get information from a property on another page.

where "5" could be a reference to the startpage or some other container page for your information.

In the Alloy MVC Templates they have created a LayoutModel where you can get information on how to solv this in MVC

Jul 02, 2014 11:09

If you have a look in IPageViewModel.cs, LayoutModel.cs and PageViewContextFactory.cs you might get the idea what they have done in the sample template so solve this.

Jul 02, 2014 11:52
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.