Display detail page using commandLink in Visualforce page

By | November 1, 2019

Hi, In this scenario we have shown how to display detail page of the record when we click on some field in output. Here we describes the usage of apex:commandLink and apex:param. Here param is used to pass individual record ids within the vf page to display detail page of the record.

Vf Page

<apex:page sidebar="false" standardController="Student__c" recordSetVar="rec">
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockSection >
              <apex:pageBlockTable value="{!rec}" var="r">
                  <apex:column headerValue="Name">
                    <apex:commandLink  rerender="out" status="mystatus">
                      <apex:param name="rId" value="{!r.Id}"/>
                  <apex:column headerValue="City">
                  <apex:column headerValue="Country">
                  <apex:column headerValue="phone">
      <apex:actionstatus id="mystatus" startText="loading.................">
          <apex:facet name="stop">
              <apex:outputpanel id="out">
                  <apex:detail subject="{!$CurrentPage.parameters.rId}" relatedList="false"/>


Click on name field Test, then detail page will be displayed below…

Leave a Reply

Your email address will not be published. Required fields are marked *