How to refer to parent repeater web part in transformation
This article describes how you can display data (e.g. 'Web part control ID') of parent repeater web part in transformation.
Basically we need to write custom script that will find the parent repeater web part in control hierarchy - it should be first parent control of 'CMSAbstractWebPart' type. We will add asp:Literal control into the transformation and then set the ID into its Text property to display it in page. Please find sample code bellow (it should be used directly in transformation):
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
protected override void OnPreRender(EventArgs e)
Control parent = this;
while ( (!(parent is CMS.PortalControls.CMSAbstractWebPart)) &&
(parent != null))
parent = parent.Parent;
if (parent is CMS.PortalControls.CMSAbstractWebPart)Applies to:
CMS.PortalControls.CMSAbstractWebPart repeater = parent as CMS.PortalControls.CMSAbstractWebPart;
Label1.Text = repeater.ID;
Kentico CMS 4.1 or later. Should work in 2.x, 3.x and 4.0 versions as well.