0

I want to display images from a static resource on visual force page. By clicking on the image the page need to redirect to another page with id passing on url and image should representing the record of leads

how to do this with coding

2 Answers 2

2

Just another solutio with "native" Salesforce functions:

public PageReference gotoPage()
{
    PageReference p = new PageReference('/apex/MyPage?=' + param);
    return p;
}

<apex:commandLink action="{!gotoPage}">
    <apex:param name="p1" value="{!myId}" assignTo="{!param}">
    <apex:image url="{!$Resource.YoutImage}"/>
</apex:commandLink>
1
<div class="row"><a href="{!$Page.mypage}?clickedOn=urlparam">
        <apex:image url="{!URLFOR($Resource.test, 'img/game01.png')}"
            alt="Snap Shot" width="239" height="169" /> 

Use href for the url .You can use URLFOR to pull image from static resource and place it in div Tag .

'ClickedOn' is my URL parameter and you can put a merge field there and pass the value to URL

2
  • 1
    <a href="/apex/{!$Page.mypage}?...> maybe? ;)
    – eyescream
    Dec 5, 2012 at 10:48
  • ya agreed .I used that for page on website and if its inside sfdc yes you are right Dec 5, 2012 at 10:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .