Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Add page to ContentArea programmatically


Hi all,

How to add a new page (new block) in the ContentArea programmatically? I want to implement this in method "public override void SetDefaultValues(ContentType contentType){}" when the object initializing.

Thanks for your help

Aug 17, 2013 8:38

I am not sure what you mean with new page? From a content area you can only reference existing pages. Todo so you could have override SetDefaultValues in your model class and do something like:

public override void SetDefaultValues(ContentType contentType)
     MainContentArea = new ContentArea();

Aug 19, 2013 8:32

Note that the Add method is obsolete as of EPiServer 7.5, which means you need to add a ContentAreaItem to the ContentArea's Items property instead.

Feb 10, 2014 13:51
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.