Web developers wiki ASP.NET Sitecore Sharepoint Kentico by Evident Interactive

Kentico: are editable regions filled?

Modified: 2010/01/20 16:33 by jim - Categorized as: ASP.NET, Kentico, Visual Studio
As a starting developer with the Kentico CMS I had the following problem:

We had 2 editable regions inside some div element. When both editable regions were not filled in the backend, the div should not be visible.

The following code sample shows how to find out:

        System.Collections.Hashtable ht = CMS.CMSHelper.CMSContext.CurrentDocument.DocumentContent.EditableRegions;
        if (ht["mediaItem"] == null && ht["mediaItemSubscript"] == null)
        {
            imageDiv.Visible = false;
        }

mediaItem and mediaItemSubscript are the ID's of the Editable regions in the aspx document

 © Evident Interactive BV