Kentico has various transformation methods that can be used to output database content to the page, one quite handy method being the EditableItems[]
method.
If you have an editable text region web part on say, the Home page, and want to display the content from within it on another page, simply add a Repeater web part and create a new transformation for it using just the following code:
<%# EditableItems["WEBPART-ID-HERE"] %>
By doing this, you only have to change the edi-region content once on the Home page, and the other page will update automatically. Furthermore, you can limit the amount of text output to the page using the LimitLength()
method. The following code limits the output to 250 characters and will append an ellipsis (…) to the end of the text:
<%# LimitLength(EditableItems["WEBPART-ID-HERE"], 250) %>
What if my edi-region is a widget?
You may have used the text region web part as a widget, which means that the ID isn’t customisable like with the web part. In which case, how do you know what ID to pass to the EditableItems[]
method? A quick way to get the ID is to press the wrench icon on the widget to open the configuration window. Now check through the URL in the address bar, there should be a widgetID parameter like this “?widgetID=editable_5”. Pass this ID to your transformation method and it should work as expected, problem solved!