IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
You can add layout controls to Pages and Page Templates. To create a LayoutControl to a Page or PageTemplate, you must:
LayoutControl
PageTemplate
PageControl
TemplateControl
ascx
.ascx
You add the Layout Control to the intended object’s Controls collection. The following example shows how to create a LayoutControl, and then add it to a Page:
Controls
You simply add theLayoutControl to the intended object’s Controls collection. The following example shows how to create a LayoutControl, and then add it to a Page Template:
To query the LayoutControls, you access the Controls collection on the Page or Template to work on those where the ObjectType is LayoutControl.
LayoutControls
When you want to put a widget inside a LayoutControl programmatically, you work with the Placeholders collection of the LayoutControl. The placeholders are the containers that form the docking zones in Sitefinity that allow you to “dock” a widget on them. For example, a LayoutControl whose template defines only a single 100% layout has a single Placeholder object in its Placeholders collection. A LayoutControl with 3 columns has three Placeholders. First, you must locate the Placeholder you want. Since the Placeholders collection is a string [] you use index to get the desired Placeholder. For example:
Then you specify the widget’s placeholder. When you create a new widget that will be added to a Sitefinity page through code, you can supply the placeholder on the page where it will be added. To do this, use the the PageManager.CreateControl<T>()method. The following example shows the creation of a basic ContentBlock and setting its placeholder before adding it to the page:
PageManager.CreateControl<T>()
ContentBlock
The following sample demonstrates:
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important