+ Start a Discussion
Rohit kumar singh 1Rohit kumar singh 1 

Getting data into table in visualforce page

User-added image
This is my VisualForce code I want to display My contact detail in this table form. But it is not showing although I have record in my contact and account object.
Thank You
ajay rawat 14ajay rawat 14

Hi Rohit,
For this you need to pass contact record id in URL.

?id=valid_contact_id

Thanks
Ajay Rawat

NagendraNagendra (Salesforce Developers) 
Hi Rohit,

Assuming that you want to display all the contact records in the visual force page.For this, you have to make use of RecordSetVar Attribute which stores the list of records pertaining to the sObject which you are referring in  standard controller.

Please try this code snippet which works fine for displaying contact records on the visual force page:
<apex:page showHeader="false" standardController="Contact" recordSetVar="contact">
    <apex:pageBlock title="contacts">
      <apex:pageBlockTable value="{!Contact}" var="con">
        <apex:column value="{!con.name}"/>
          <apex:column value="{!con.title}"/>
          <apex:column value="{!con.phone}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>
Please find the desired output as below in the screenshot.
User-added image

Please mark this as solved if it's resolved so that others can get benefit of it who are encountering a similar issue.

Best Regards,
Nagendra.