CMSRepeater, Related pages and Teaser Image

I'm trying to get the MenuItemTeaserImage in a CMSRepeater but after some searching I can't manage to get it working. The GetImage function is not working because its 'does not exist in the current context'. What am I doing wrong here?

Correct Answer

The GetImage method return whole img tag so it would break your HTML markup. What you need is the GetFileUrl method instead (taking also attachmentGUID as its parameter), but since the MenuItemTeaserImage already contains the attachmentGUID, you can build the url "manually" to save some performance:

Or you could specify a transformation by setting the TransformationName on the Repeater control, instead of defining an <ItemTemplate> - that will give you access to transformation methods, as well as the ability to edit transformations in Kentico.