Extend the Archive widget to use dynamic items

Use the following tutorial to extend the built-in Archive widget to display items created with the Module builder.

Perform the following:

  1. Open your project in Visual Studio.
  2. In the context menu of SitefinityWebApp, click Add » New Folder.
    Name the folder Controls
  3. In the context menu of the folder, click Add New Item... » Visual C# » Code » Class.
    Name the class CustomArchiveWidget.cs
  4. Open the created class and paste the following code:
  5. Build your solution.
  6. Register the new widget.
    For more information, see Register a new widget in Sitefinity CMS toolbox.
  7. Get the ContentType of your dynamic item.
    You do this in the following way:
    1. Navigate to Administration » Module Builder » <Your module>
    2. Open Code reference for <your module>.
    3. Click your content type and select one of the code snippets
    4. For example, Create <your content type>
    5. Copy the content type, as in the following screenshot:

      content type

  8. Create e new page or edit an existing one.
  9. Add the Custom Archive widget that you created on the page.
  10. Add the widget of your content type on the page.
  11. Edit the Custom Archive widget.
    In ContentType input field, enter the content type you copied in Step 7.
  12. Save your changes and publish the page.

Was this article helpful?