How to fetch document name at page template.

Anand Dev Singh asked on November 11, 2014 09:13

Hi Team,

Am using Kentico v7.0.34.

I have create a page template (Layout type = ASCX) and i want to populate the document name of the page on which the template we will used.

I have tried something like belwo code in the page template code but it haven't worked:

Page Name Is : <%# CurrentPageInfo.DocumentName %>


Page Name Is : <%# Eval("DocumentName") %>

Any help will be highly applicable.

Correct Answer

Jan Hermann answered on November 11, 2014 16:19


Yes, you can either use <%= CMS.DocumentEngine.DocumentContext.CurrentDocument.DocumentName %> in your ASCX layout, or you can switch to HTML type and use {% CurrentDocument.DocumentName %}.

Best regards,
Jan Hermann

1 votesVote for this answer Unmark Correct answer

Recent Answers

Brenden Kehren answered on November 11, 2014 16:01

Try CurrentDocument.DocumentName. This will get the name of the document you are navigating to.

0 votesVote for this answer Mark as a Correct answer

Anand Dev Singh answered on November 12, 2014 04:10

Thanks for your reply.

I have used below codes and its working:

1) <%=CMS.CMSHelper.CMSContext.CurrentDocument.DocumentName%>

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

0 votesVote for this answer Mark as a Correct answer

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