Displaying Teaser image

Jeewani Jayasuriya asked on July 9, 2020 13:38

Hello, I am using Article page type to upload information. When I am trying to display the information on a page. I am getting below erorr.

The name 'GetAttachmentUrlByGUID' does not exist in the current context

Thanks!

Recent Answers


Dmitry Bastron answered on July 9, 2020 14:44

Hi Jeewani,

Can I ask you a few more clarification questions:

  • What version of Kentico are you using?
  • Is it Portal Engine or MVC?
  • Where and how do you display this information? Could you post the code part containing GetAttachmentUrlByGUID?
0 votesVote for this answer Mark as a Correct answer

Jeewani Jayasuriya answered on July 9, 2020 14:48

What version of Kentico are you using? Kentico 10 Is it Portal Engine or MVC? Portal Engine

Where and how do you display this information? Could you post the code part containing GetAttachmentUrlByGUID?

<%@ Register Src="~/CMSModules/Content/Controls/Attachments/DocumentAttachments/DocumentAttachments.ascx" TagName="DocumentAttachments" TagPrefix="cms" %>

<img class="img-responsive" src="<%# GetAttachmentUrlByGUID(Eval("ArticleTeaserImage"), Eval("ArticleName")) %>" alt="<%# Eval("ArticleName") %> " style="width: 175px;" class="img-responsive">

<%# Eval("ArticleName") %>

<%# Eval("ArticleText") %>

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on July 9, 2020 14:57

Is it inside ASCX transformation (or ASCX layout) or is it in your custom web part? Or any other part of your solution?

0 votesVote for this answer Mark as a Correct answer

Jeewani Jayasuriya answered on July 9, 2020 15:03

It is inside ASCX transformation.

Thanks!

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on July 9, 2020 15:06

Ok, I think I've found what is the problem. In Kentico 10 this method doesn't exist. It was introduced in Kentico 11. Check this page for Kentico 10 transformation methods and compare with Kentico 11 transformation methods. In Kentico 10 there is only GetAttachmentUrl method available.

0 votesVote for this answer Mark as a Correct answer

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