WebControl for rendering page properties.

Namespace:  EPiServer.Web.WebControls
Assembly:  EPiServer.Web.WebControls (in EPiServer.Web.WebControls.dll) Version: 6.0.530.0

Syntax

C#
[ValidationPropertyAttribute("PropertyValue")]
[DefaultPropertyAttribute("PropertyName")]
public class Property : WebControl, INamingContainer, 
	IPageSource, IPageControl

Remarks

The Property control is used on web forms and user controls and renders the value of built-in or custom properties to the HTML stream.

Examples

The following example shows how to print the name of the page to HTML:
Copy 
<EPiServer:Property PropertyName="PageName" runat="server" />
Note: The PropertyName attribute is not case sensitive.

For the Property control to be able to read the properties from the page, it needs to be hosted on a web form or a control that implements the IPageSource interface. The control will iterate through the control hierarchy looking for this interface, and when it finds one it will use the CurrentPage property to read the information about the specific built-in or custom property.

If you put a Property control inside a templated control like the PageList control, that implements IPageSource, the Property control will use the CurrentPage property of the template control instead. The PageList then points the Property control to the current PageData object in its internal PageDataCollection. This is why the two following PageList examples will print the same:

Copy 
<EPiServer:PageList PageLink="<%#EPiServer.Core.PageRegerence.StartPage%>" runat="server">
    <ItemTemplate>
        <EPiServer:Property PropertyName="PageName" runat="server" />
    </ItemTemplate>
</EPiServer:PageList>

<EPiServer:PageList PageLink="<%#EPiServer.Core.PageRegerence.StartPage%>" runat="server">
    <ItemTemplate>
        <%#Container.CurrentPage.PageName%>
    </ItemTemplate>
</EPiServer:PageList>
You can also access the inner PropertyData object through the InnerProperty property, if you need access to the raw value.

Inheritance Hierarchy

System..::.Object
  System.Web.UI..::.Control
    System.Web.UI.WebControls..::.WebControl
      EPiServer.Web.WebControls..::.Property

See Also