Add a layout control to a page
The following example adds the layout control to a specified page:
Using the code above you add a layout control to the Header, Content, Right Sidebar, or Footer of a page that inherits from a template that has these controls. The layout control uses the template control as a placeholder. Thus, you are able to break an entire row into columns.
To place a layout control in a placeholder, you first need to find that placeholder. Depending on the template control, you can use the Placeholders collection from the control itself or select the Id value from the control Properties collection.
Then, you initialize the PageManager and based on the page Id you get the page data. To add a layout control, you must create the temp draft of the page. To do this, you use the EditPage method and specify the Id of the page. Then, you create the layout control using the CreateControl<PageDraftControl> method of the PageManager. You then specify all the necessary properties for the layout control (the caption, object type, placeholder, and so on). You set the default permissions by calling SetControlDefaultPermissions method. Then, you add the control to the temp draft page and call CheckIn to get the master. Finally, you publish the page using the WorkflowManager class and pass the required parameters to the MessageWorkflow method.