How to get Menu Item Teaser Image in Page Template layout

TRISHUL TANDEL asked on October 9, 2018 21:12

How to get Menu Item Teaser Image in Page Template layout. I have used ASCX page type.

Recent Answers


Alex Golebiewski answered on October 9, 2018 23:02 (last edited on December 10, 2019 02:31)

{% GetFileUrlByGUID(CurrentDocument.GetValue("MenuItemTeaserImage", string.Empty), "File Name") |(identity)GlobalAdministrator%}

That is a macro that will pull the image. If you want to use it in a transformation, you should be able to use <%# GetFileUrl(Eval("MenuItemTeaserImage")) %>

Then you should be able to put the answer of those into a src tag of an image.

You can also use the <%# GetImage("NewsTeaser") %> transformation method helper.

Click here for transformation helper methods.

Is that what you're looking for?

1 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on October 10, 2018 13:49

Using code blocks <%...%> in ASCX layout can cause issues. It is not supported. I would recommend using HTML layout and macros like suggested by Alex. Or, use SCRIPT tags and inside them use standard C# and API on the page load event to get the teaser image. Or, create a custom web part which will do the job.

0 votesVote for this answer Mark as a Correct answer

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