Try our conversational search powered by Generative AI!

Class ContentRenderer

Webcontrol for BlockData. The control with create a child control with the selected render for the block type.

Inheritance
System.Object
ContentRenderer
Implements
System.Web.UI.INamingContainer
Namespace: EPiServer.Web.WebControls
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
public class ContentRenderer : WebControl, IContentSource, INamingContainer

Constructors

ContentRenderer()

Initializes a new instance of the ContentRenderer class.

Declaration
public ContentRenderer()

Properties

AttributeAssembler

The attribute assembler

Declaration
public Injected<IContentAreaItemAttributeAssembler> AttributeAssembler { get; set; }
Property Value
Type Description
Injected<IContentAreaItemAttributeAssembler>

ContentAreaItem

Gets or sets the content area item.

Declaration
public ContentAreaItem ContentAreaItem { get; set; }
Property Value
Type Description
ContentAreaItem

CurrentContent

Gets or sets the current content.

Declaration
public IContent CurrentContent { get; set; }
Property Value
Type Description
IContent

CurrentControl

Gets or sets the block, which will be rendered.

Declaration
public Control CurrentControl { get; set; }
Property Value
Type Description
System.Web.UI.Control

CurrentData

Gets or sets the block, which will be rendered.

Declaration
public IContentData CurrentData { get; set; }
Property Value
Type Description
IContentData

CustomTagName

Gets or sets the tag name. If not set a div-tag will be used.

Declaration
public string CustomTagName { get; set; }
Property Value
Type Description
System.String

IsCircularReference

Gets or sets a value indicating whether the CurrentControl is in a chain with circular references.

Declaration
public bool IsCircularReference { get; set; }
Property Value
Type Description
System.Boolean

LocalizationService

Gets or sets the localization service.

Declaration
protected Injected<LocalizationService> LocalizationService { get; set; }
Property Value
Type Description
Injected<LocalizationService>

The localization service.

RenderSettings

Gets or sets the render settings that should be passed on to the content template.

Declaration
public IDictionary<string, object> RenderSettings { get; set; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.String, System.Object>
Remarks

Note that the Tag property must be used to affect the template selection even if the RenderSettings dictionary contains a Tag or DisplayOptions (with Tag) entry.

RenderType

Sets the RenderType for the ContentRenderer.

Declaration
public RenderType RenderType { get; set; }
Property Value
Type Description
RenderType

A RenderType that is used to specify how the ContentRenderer should be rendered.

Tag

Gets or sets the current tag.

Declaration
public string Tag { get; set; }
Property Value
Type Description
System.String

TagName

Declaration
protected override string TagName { get; }
Property Value
Type Description
System.String

TemplateControlLoader

Gets or sets the template control loader, which will be used to find the correct controller for rendering the block.

Declaration
[Obsolete("Use TemplateControlLoaderService instead")]
public Injected<ITemplateControlLoader> TemplateControlLoader { get; set; }
Property Value
Type Description
Injected<ITemplateControlLoader>

TemplateControlLoaderService

Gets or sets the template control loader, which will be used to find the correct controller for rendering the block.

Declaration
public Injected<ITemplateControlLoader> TemplateControlLoaderService { get; set; }
Property Value
Type Description
Injected<ITemplateControlLoader>

Methods

CreateChildControls()

The TemplateControlLoader will try to resolve the block control, which will be added to control collection.

Declaration
protected override void CreateChildControls()

DataBind()

Binds a data source to the ContentRenderer and all its child controls.

Declaration
public override void DataBind()

EnsureChildControlsCreated()

Ensures that the child controls have been created, or create them.

Declaration
public void EnsureChildControlsCreated()

Get<T>(ContentReference)

Retrieves a IContent object with information about a content, based on the ContentReference parameter.

Declaration
public T Get<T>(ContentReference contentLink)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

Reference to the content being retrieved

Returns
Type Description
T

IContent object requested

Type Parameters
Name Description
T

GetChildren<T>(ContentReference)

Retrieve a IContent listing

Declaration
public IEnumerable<T> GetChildren<T>(ContentReference contentLink)
    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

Reference to parent content

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

Returns a collection of IContent directly below the content referenced by the ContentReference parameter.

Type Parameters
Name Description
T

RenderBeginTag(HtmlTextWriter)

Renders the HTML opening tag of the control to the specified writer if there is a current control available or if in edit mode.

Declaration
public override void RenderBeginTag(HtmlTextWriter writer)
Parameters
Type Name Description
System.Web.UI.HtmlTextWriter writer

A System.Web.UI.HtmlTextWriter that represents the output stream to render HTML content on the client.

RenderEndTag(HtmlTextWriter)

Renders the HTML closing tag of the control into the specified writer if there is a current control available or if in edit mode.

Declaration
public override void RenderEndTag(HtmlTextWriter writer)
Parameters
Type Name Description
System.Web.UI.HtmlTextWriter writer

A System.Web.UI.HtmlTextWriter that represents the output stream to render HTML content on the client.

Implements

System.Web.UI.INamingContainer

Extension Methods