CMSDocumentValue
The CMSDocumentValue control displays a value from the data (columns) of the currently displayed Kentico page. You can place the control into:
Note
You can alternatively display page values through macro expressions. Use the CurrentPageInfo (or CurrentDocument) objects in macros to access the fields of the current page. You can place macros directly into text displayed on the website’s pages.
For example: {% CurrentPageInfo.DocumentName %}
Getting started
The following tutorial shows how to display the page name of the currently selected page using the CMSDocumentValue control:
Create a new ASPX page template.
In Visual Studio, drag the CMSDocumentValue control from the toolbox onto the page template’s form.
Set the following properties for the CMSDocumentValue control:
AttributeName: DocumentName
FormattingString: Document name: {0}
<cms:CMSDocumentValue ID="CMSDocumentValue1" runat="server" AttributeName="DocumentName" FormattingString="Document name: {0}" />
Create a page based on the template in the Kentico administration interface.
If you view the page on the website, the control displays the name of the currently selected page. In real-world scenarios, you would add the control to ASPX page templates that already have other functions, or into the code of page layouts when using the portal engine.
Configuration
You can set the following properties for the CMSDocumentValue control:
Property Name |
Description |
Sample value |
AttributeName |
Name of the page field (column) whose value the control displays. |
“DocumentName” |
ClassNames |
List of page types for which the control displays the value. You can add multiple page types separated by semicolons (;). |
“cms.article;cms.menuitem” |
FormattingString |
.NET formatting expression used for displaying the value. |
“Name: {0}” |
StopProcessing |
If false, the control does not load or display any data. |