+ Start a Discussion
ch ranjithch ranjith 

How to display link in pageblocktable values??? i Need link if i press link it should display the detail page for that account

<apex:page standardController="account" recordSetVar="items">
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!items}" var="vartodisplay">
<apex:column value="{!vartodisplay.name}"/>
<apex:column value="{!vartodisplay.industry}"/>
<apex:column value="{!vartodisplay.rating}"/>
<apex:column value="{!vartodisplay.website}"/>
<apex:column value="{!vartodisplay.phone}"/>
<apex:column value="{!vartodisplay.parentid}"/>

</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Best Answer chosen by ch ranjith
Shyam BhundiaShyam Bhundia
You can use apex:outputLink tag.

Add another column or replace an existing column with
 
<apex:column headerValue="Account">
     <apex:outputLink value="/{!vartodisplay.id}">"{!vartodisplay.name}"</apex:outputLink>
</apex:column>

Hope this helps!



All Answers

Virendra ChouhanVirendra Chouhan
Hi Ch Ranjith

Use this code
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!items}" var="vartodisplay">
<apex:column value="{!vartodisplay.name}"/>
<apex:column value="{!vartodisplay.industry}"/>
<apex:column value="{!vartodisplay.rating}"/>
<apex:column value="{!vartodisplay.website}"/>
<apex:column value="{!vartodisplay.phone}"/>
<apex:column value="{!vartodisplay.parentid}"/>
<apex:column >
     <apex:commandLink action="{!URLFOR($Action.Account.View, vartodisplay.id)}" value="Click to view"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
Regards
Virendra

Shyam BhundiaShyam Bhundia
You can use apex:outputLink tag.

Add another column or replace an existing column with
 
<apex:column headerValue="Account">
     <apex:outputLink value="/{!vartodisplay.id}">"{!vartodisplay.name}"</apex:outputLink>
</apex:column>

Hope this helps!



This was selected as the best answer