How to use DocumentModifiedWhen in a Hierarchical Transformation

Mike Bilz asked on February 5, 2020 19:06

Hello Kentico Team,

I am attempting to build a report of sorts that will include the last time a page was modified.

I am building this using a Hierarchical Transformation so that the report will match the tree structure.

My transformation included the following attempt to pull in the DateModifiedWhen information: <%# FormatDateTime(DocumentModifiedWhen, "MM/dd/yyyy") %>

However this returned the following error: kentico error CS0103: The name 'DocumentModifiedWhen' does not exist in the current context

How do I modify my request to meet kentico's context expectations? I tried using TreeNode.DocumentModifiedWhen instead, but that just resulted in a slightly different error.

Is there something I need to include to dictate which level of hierarchy I am on, or a different namespace I need to call?

Thanks in advance.


Correct Answer

Dat Nguyen answered on February 5, 2020 19:13

You have to Eval the property:

<%# FormatDateTime(Eval("DocumentModifiedWhen"), "MM/dd/yyyy") %>
0 votesVote for this answer Unmark Correct answer

Recent Answers

Mike Bilz answered on February 5, 2020 20:14

Thank you, Dat. I was definitely trying to over-complicate it.


0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.