Dynamicweb 8 Documentation
GetContent Method (ContentModule)
Example 

Override this method and return the HTML output for the module.
Syntax
'Declaration
 
Public Overridable Function GetContent() As String
public virtual string GetContent()

Return Value

Must return the markup that renders the module.
Remarks
The markup returned is what is inserted into the template tag ParagraphModule in the paragraph template.
Example
How to inherit ContentModule and override GetContentHow to inherit ContentModule and override GetContent
using Dynamicweb.Extensibility;

namespace Dynamicweb.Examples.CSharp
{
    [AddInName("ModuleSystemName")]
    public class Frontend : ContentModule
    {
        public override string GetContent()
        {
            //Get an instance of a template object
            var template = new Dynamicweb.Rendering.Template("ModuleSystemName/Template.html");

            //Set a tag named "Text" with the value from the HelloText property
            template.SetTag("Text", Properties.Values["HelloText"].ToString());

            //Add a tag with the system name of the module. That would be the same as in the [AddInName()] attribute
            template.SetTag("ModuleSystemName", this.ModuleSystemName);

            //Add the page id executing the page with the paragraph where this module is attached
            template.SetTag("PageID", this.Pageview.ID);

            //Return the parsed template to the event handler
            return template.Output();
        }
    }
}
Imports Dynamicweb.Extensibility

Public Class ContentModuleSample
    <AddInName("ModuleSystemName")> _
    Public Class Frontend
        Inherits Global.Dynamicweb.ContentModule

        Public Overrides Function GetContent() As String
            'Get an instance of a template object
            Dim template As Global.Dynamicweb.Rendering.Template = New Global.Dynamicweb.Rendering.Template("ModuleSystemName/Template.html")

            'Set a tag named "Text" with the value from the HelloText property
            template.SetTag("Text", Properties.Value("HelloText"))

            'Add a tag with the system name of the module. That would be the same as in the <AddInName()> attribute
            template.SetTag("ModuleSystemName", Me.ModuleSystemName)

            'Add the page id executing the page with the paragraph where this module is attached
            template.SetTag("PageID", Me.Pageview.ID)

            'Return the parsed template to the event handler
            Return template.Output()
        End Function
    End Class
End Class
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ContentModule Class
ContentModule Members

Send Feedback