The EPiServer CMS dynamic content function allows developers to create functionality in code which will then be utilized by an editor working in the HTML editor.
A Dynamic Content class does not define a whole page rather just a small section of it, this makes it suitable for smaller functionality that will be inserted inline into texts on the site by the editor. User Controls can be used to implement the user interface part of a dynamic content object. A nice analogy would be a .NET UserControl, which in fact can be used to implement the user interface of a dynamic content object.
Dynamic Content has the following advantages:
- Enables the developer to render the contents with any .NET derived type of control directly into texts written by an editor.
- Dynamic Content is fully integrated into the EPiServer CMS core and improves performance since the parsing engine is optimized for it.
- Uses hashes to make sure only EPiServer CMS code can update the contents.
- Fully adapts ASP.NET functionality.
Developing dynamic content
When developing dynamic content, consider the following:
- Create a .NET class that implements the IDynamicContentControl (contains Web Forms specific methods) or IDynamicContentView (for both MVC and WebForms) interface.
- You need to register the dynamic content type using either the DynamicContentPlugIn attribute or by registering it in the web.config.
- The editor creates an instance of the dynamic content class, sets its properties and places it as desired in the EPiServer CMS HTML editor.
- When the page is rendered, EPiServer CMS replaces the dynamic content design time markup with the actual HTML output of the dynamic content class or its delegated control.