• sarath garimella
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi,
I would like to know how we can create a controller extension for a custom controller.

My custom controller:

public class account_details{

public list<Account> accnt_list{get;set;}

public account_details(){
accnt_list= new list<Account>();
accnt_list=[select id,Name,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry,ShippingStreet,ShippingCity,ShippingState,ShippingPostalCode,ShippingCountry FROM Account order by Name];
}
public pagereference edit_row(){
string str=apexpages.currentpage().getparameters().get('edit_id');
system.debug('------->'+str);
pagereference pg=new pagereference('/'+str+'/e');
return pg;
}
MY PAGE:

<apex:page controller="account_details">
  <apex:sectionHeader title="Account details"/>
  <apex:form >
   <apex:pageBlock >
   <apex:pageBlockSection >
   <apex:pageBlockTable value="{!accnt_list}" var="test_var">
   <apex:column headerValue="Action">
   <apex:commandLink value="EDIT" action="{!edit_row}">
   <apex:param name="edit_id" value="{!test_var.id}"/>
   </apex:commandLink>
   </apex:column>
   <apex:column headerValue="Account Name" value="{!test_var.Name}"/>
   <apex:column headerValue="Billing Street" value="{!test_var.BillingStreet}"/>
   <apex:column headerValue="Billing City" value="{!test_var.BillingCity}"/>
   <apex:column headerValue="Billing State" value="{!test_var.BillingState}"/>
   <apex:column headerValue="Billing Zip Code" value="{!test_var.BillingPostalCode}"/>    
   <apex:column headerValue="Billing Country" value="{!test_var.BillingCountry}"/>      
   <apex:column headerValue="Shipping Street" value="{!test_var.ShippingStreet}"/>
   <apex:column headerValue="Shipping City" value="{!test_var.ShippingCity}"/>
   <apex:column headerValue="Shipping State" value="{!test_var.ShippingState}"/>
   <apex:column headerValue="Shipping Zip Code" value="{!test_var.ShippingPostalCode}"/>    
   <apex:column headerValue="Shipping Country" value="{!test_var.ShippingCountry}"/>        
   </apex:pageBlockTable>
  
   </apex:pageBlockSection>
    </apex:pageBlock>

---------------------------------
So now I would like to create an extension so that I would like to use STR value(the id of account) and use it in another page. I tried online but all the codes I see are for a standard controller extension.

Thanks in advance