CMSDocumentValue

The CMSDocumentValue control displays a value from the data (columns) of the currently displayed Kentico document. You can place the control into:

Note

You can alternatively display document values through macro expressions. Use the CurrentPageInfo (or CurrentDocument) objects in macros to access the fields of the current document. 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 document name of the currently selected document using the CMSDocumentValue control:

  1. Create a new ASPX page template.

  2. In Visual Studio, drag the CMSDocumentValue control from the toolbox onto the page template’s form.

  3. 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}" />


  1. 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 document. 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 document field (column) whose value the control displays.

“DocumentName”

ClassNames

List of document types for which the control displays the value. You can add multiple document 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.