Activity Forums Salesforce® Discussions Display list in visualforce page Reply To: Display list in visualforce page

  • shariq

    Member
    July 18, 2017 at 10:56 am

    Hi Ajay,

    you can try this :-

    Apex

    public class Records
    {
    public List con {get;set;}
    public void search()
    {
    con = [SELECT LastName, Id FROM Contact LIMIT 100];
    }
    }

    Visualforce Page

    <apex:page controller = "Records">
    <apex:form>
    <apex:pageBlock>
    <apex:commandButton value = "records" action = "{!search}"/>
    <apex:pageBlockTable value="{!con}" var = "contact">
    <apex:column value = "{!contact.LastName}"/>
    <apex:column value = "{!contact.Id}"/>
    </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
    </apex:page>