ASPX templates
Version 7.x > ASPX templates > Getting current document properties in transformation View modes: 
User avatar
Member
Member
Cliff - 8/19/2013 5:02:28 PM
   
Getting current document properties in transformation
How do you get properties of document that is holding a repeater? So say Page X has a repeater showing a list of documents, but you want to compare the objects to a property of Page X. How do you do that?

User avatar
Member
Member
kentico_edwardh - 8/20/2013 12:26:58 PM
   
RE:Getting current document properties in transformation
Hello Cliff,

I am not sure which properties you are looking to return, but you can use any property of CurrentDocument to return the information in a transformation. The example below will return the current document name within a transformation -

<%=CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{% CurrentDocument.DocumentName %}")%>

Best Regards,
Edward Hillard

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 8/29/2013 3:40:19 PM
   
RE:Getting current document properties in transformation
To simplify this even more you don't need to use the macro syntax in the transformation, simply use
<%# EvalText("DocumentName") %>
to get the rendered document name. If you want to get the current document name then simply use
<%# CMSContext.CurrentDocument.DocumentName %>
The difference between the two is CurrentDocument.DocumentName will be the document you are navigating to whereas the EvalText("DocumentName") will get the name of the document being rendered by the repeater from your dataset.