function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
EIE50EIE50 

When clicked on an account link, user should navigate to respective account page

Hi,

 

when i click on any of the account listed, it should navigate to that particular account page. Currently, when i click on any of the account, the page gets refreshed and remains in the same place. Can any one tell me how this can be achived. Here is the VF'code,

 

<apex:page standardController="Account" recordSetVar="accounts">
 <apex:pageBlock title="Viewing Accounts">
  <apex:form id="theForm">
   <apex:pageBlockSection>
    <apex:dataList value="{!accounts}" var="a" type="1">                <apex:commandLink>{!a.name} </apex:commandLink>
    </apex:dataList>
   </apex:pageBlockSection> 
   <apex:panelGrid columns="4">
     <apex:commandLink action="{!first}">First</apex:commandLink>
     <apex:commandLink action="{!previous}">Previous</apex:commandLink>
     <apex:commandLink action="{!next}">Next</apex:commandLink>
     <apex:commandLink action="{!last}">Last</apex:commandLink>
   </apex:panelGrid>
  </apex:form>
 </apex:pageBlock>  
</apex:page>

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
Pradeep_NavatarPradeep_Navatar

In my opinion, outputlink component seems more appropriate than commandlink. Try using the code below :

 

<apex:outputLink value="/{!a.Id}" target="_top">{!a.Name}</apex:outputLink>

 

Did this answer your question? if so, please mark it solved.

All Answers

mikefitzmikefitz

Your command link need to be fixed ....you are not linking to anything

 

<apex:commandLink>{!a.name} </apex:commandLink>

should be something like

<apex:commandLink value="{!a.id}">{!a.name}</apex:commandLink>

 

Good Luck!!

 

 

Pradeep_NavatarPradeep_Navatar

In my opinion, outputlink component seems more appropriate than commandlink. Try using the code below :

 

<apex:outputLink value="/{!a.Id}" target="_top">{!a.Name}</apex:outputLink>

 

Did this answer your question? if so, please mark it solved.

This was selected as the best answer
MayeUPAEPMayeUPAEP

Hi,

 

I've made a similar list with my tasks using Data Tables.  Check the next link 

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_dataTable.htm

 

Hope It could help you

EIE50EIE50

Hi,

 

Thanks for the valuable inputs.

 

Mike : In command link if i use a value attrribute equal to {!a.id}, i get output like 07800000000aacDcikenson plc, and whn i click on the account displayed above i still stay on the same page after a page refresh.

 

Thanks.