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
ravi1234.ax1565ravi1234.ax1565 

edit method in visual force page

hello goup,

 

 

       i hav a few records in page block table

 

          i placed an edit link (command link) in vf page 

 

           

<apex:column headerValue="Action">
<apex:commandLink value="Edit" action="{!Edit}" id="edit"/>

 </apex:column>          

               my requiremnt is i want to edit a single record 

             

                   how can achieve this by writing code in controller class

 

                   can any one help me to achieve my requiremnt.....

 

 

   thanks for giving reply in advance       

 

 

 

 

 

Hengky IlawanHengky Ilawan

Hi,

 

To access the standard edit page basically is just adding "/e" to the end of the detail page URL. For eq "/<record id>/e".

 

So, if your link is only for redirecting user to the standard edit page, you can use apex:outputLink instead.

 

<apex:outputLink value="/{!therecordId}/e" id="edit">Edit</apex:outputLink>

Or if you need to use commandlink, then call the edit method of pagereference class in your action method:

 

PageReference editPage = new ApexPages.StandardController(<theSobjectVariable>).edit();
editPage.setRedirect(true);
return editPage;

More detail on page reference class:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_pages_pagereference.htm

 

-Hengky-