Modify default templates used in all dynamic content widgets

Sitefinity CMS enables you to change the appearance of dynamic content MVC widgets through their comprehensive set of properties. In some cases, you need to further customize the look of MVC built-in widgets. You may want to implement some custom logic on the template, for example, a dropdown menu.

Use the following procedure to customize the view of the dynamic content MVC widget:

  1. Open the Sitefinity CMS GitHub repository repository and navigate to Telerik.Sitefinity.Frontend.DynamicContent » WidgetTemplates » ContainerTemplates.
  2. Depending on whether you want to customize the List or Detail views, copy one of the following files:
    • List.<template name>.cshtml
      The controller passes the @model Telerik.Sitefinity.Frontend.DynamicContent.Mvc.Models.DynamicContentListViewModel to the view 
    • Detail.<template name>.cshtml
    • The controller passes the @model Telerik.Sitefinity.Frontend.Mvc.Models.ContentDetailsViewModel to the view 
  3. Open your project in Visual Studio.
  4. Under SitefinityWebApp, create a new folder and name it WidgetTemplates.
  5. Inside folder WidgetTemplates, create a new folder and name it ContainerTemplates.
  6. Inside folder ContainerTemplates,  paste the view copied in Step 2.
  7. Open the file and edit it in the following way:

    NOTE: The new template is available only for new dynamic content types.

  8. If you want to apply the template to existing dynamic content types, regenerate their widget templates.
    To do this, perform the following:
    1. Click Administration » Module builder.
    2. Open the module and then open the dynamic content type.
    3. Click the Finish button and in the dialog box, select Update widget templates as well.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.


Was this article helpful?