Now i want to get the parent document name in a transformation. How can i do that?
Thanks.
{%CurrentDocument.Parent.DocumentName%} or <%# CurrentDocument.Parent.DocumentName %>
{%CurrentDocument.Parent.DocumentName%}
<%# CurrentDocument.Parent.DocumentName %>
The <%# CurrentDocument.Parent.DocumentName %> may not always work and can cause an error. I would try using this syntax instead: <%= CMS.MacroEngine.MacroResolver.Resolve("{%CurrentDocument.Parent.DocumentName#%}") %> but it may end up with the same error. For ASCX transformation I would rather recommend building a custom method and use the API to get the information you want.
<%= CMS.MacroEngine.MacroResolver.Resolve("{%CurrentDocument.Parent.DocumentName#%}") %>
@Juraj is right. You need a full path: for ascx you need the <%= CMS.DocumentEngine.DocumentContext.CurrentDocument.Parent.DocumentName %>
<%= CMS.DocumentEngine.DocumentContext.CurrentDocument.Parent.DocumentName %>
Please, sign in to be able to submit a new answer.