Retrieving Editable Regions in Kentico

Problem : Retrieve contents of editable regions in Kentico

Kentico CMS allows you to use a custom control called CMSEditableRegion. There are times when you might need to check the contents of this region and perform some checks to implement business rules.

Solution : Check for the EditableRegion property on the Current document

Each document has a property called EditableRegions which is basically a key value pair. If an editable region is on the page then the name (in lower case) is stored as a key in Editable Regions.

if (CMSContext.CurrentDocument.DocumentContent.EditableRegions.ContainsKey("uxpagetitle"))
{
         content = CMSContext.CurrentDocument.DocumentContent.EditableRegions["uxpagetitle"].ToString();
}
Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">