+ Start a Discussion
cool 183cool 183 

APEX and VF code

how to get the existing record values to the visualforce page using controller class..?? I have created an object and it has records in it. I have also created a visualforce page similar to that object detail page. I want to get those existing record values into my vf page. Plz help me how to do it.
Orkhan_ShukurovOrkhan_Shukurov
You don't need Apex for this requirement. You just need to reference your object's standard controller in your visualforce page. E.g. if you have a custom object called "Country" then you can simply display the records in visualforce page like this:
 
<apex:page standardController="Country__c">
<apex:form>

<apex:outputField value="{!Country__c.Name}"/>
<apex:outputField value="{!Country__c.Population__c}"/>

</apex:form>
</apex:page>
Krishna SambarajuKrishna Sambaraju
Here is an example of a VF page that displays the details of an account.
 
<apex:page standardController="Account">
    <apex:detail />
</apex:page>

You also need to pass the id of the object as url parameter for the visualforce page (example: /apex/AccountDetailPage?id=0012400000AlmaI).

Hope this helps.