Add and remove widgets from pages

Sitefinity CMS enables you to add and remove controls from a page through the Pages API.

When adding a control to page, you perform the following steps:

  1. Get the page node or data.
    When adding control to page, you first must get the page node or data. For more information about finding a specific page node and data, see For developers: Query pages.
  2. Get the temp draft of the page.
    You must add the controls to the temp draft of the page.
  3. Create draft control.
    To create the draft control, you use the page manager. To duplicate the control in the UI, you must set the ID property of the original control. For more information, see For developers: Generate unique control Id.
    When creating the draft control, we recommend to set the following properties:
    • Caption
      The interface label for the control.
    • SiblingId
      The preceding control Id. You must set this property for correct order of the controls in the page.
  4. Set default permissions for the draft control.
    You must set the default permissions for the draft control.
  5. Add the control.
    After you set the properties and permissions, you add the control to the temp draft of the page.
  6. Get master version of the page.
    After you add the control to the page, you must check in the page to get the master version.
  7. Publish the page.
    To publish the page, you use the workflow manager.

Was this article helpful?

Next article

Widget designers