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

How to include the standard button edit



I want to  include the standard button "Edit" into my own visualforce page. So, if anybody clicks on the ID of an entry, the relative edit page should open.


My approach:



<apex:pageBlock title="Title">
<apex:dataTable value="{!method}" var="Object" width="100%">
<apex:column >
<apex:facet name="header">ID</apex:facet>
<apex:form >
<apex:commandLink value="{!object.ID__c}" action="{!Edit}"/>


 The method (in dataTable value) is defined in an apex class and returns a list of several objects with some attributes. One of these attributes is ID__c.

I'm already able to display the ID as normal text, but it isn't shown as commandLink with the action Edit.


Does anybody knows why?


Thanks in advance!





Hello student;

First, in order to use the standard edit button your page need to have a StandardController. 


<apex:page standardController="Opportunity" extensions="MyClass">


 Second, if there is no valid Opportunity id (If standardController is Opportunty) in the page URL you still can't see the  commandLink.


 I think now you will be able to view the IDs in your page. But you can't use the link for your purpose because by clicking this link you can edit only the Opportunity which related to the id on page URL(id=006xxxxxxxxx).




Use the Command Link like this-


<apex:commandLink action="{!Edit}">





you rather need to use outputlink


<apex:dataTable value="{!method}" var="object" id="pb">        

        <apex:facet name = "header">ID</APEX:FACET>
      <apex:outputLink value="/{!object.Id__c}"><b>{!object.Id__c}</b></apex:outputLink>