+ Start a Discussion
Sumanth Kumar 17Sumanth Kumar 17 

About displaying of account records

Hello all,
I need to display 10 records in a page where records residing in output panel.
Can anyone help me with this?
Thank you in advance !
Sumanth Kumar
Nayana KNayana K
Visualforce page:

<apex:page controller="Sample" >
    <apex:form >
       <apex:pageblock id="account" title="Account Details)" >
           <apex:outputPanel>
            <apex:pageblockTable value="{!lstAcc}" var="a">
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Type}"/>
            </apex:pageblockTable>
</apex:outputPanel>
        </apex:pageblock>
              
    </apex:form>
</apex:page> 

Controller:

public with sharing class Sample 
{    
    public List<Account> lstAcc {get;set;}
       
    public sample()
    {
        // recently created 10 records
        lstAcc = [SELECT Name, Type FROM Account LIMIT 10 ORDER BY CreatedDate DESC];

    }
}

Can you please elaborate your requirement in more detail, to display 10 records outputpanel is not needed. If we keep also no problem. 
Balaji BondarBalaji Bondar
Hi Sumanth,

You can use standard set controller to achive above functionality.Please refer link below for more details:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/apexcode/apex_pages_standardsetcontroller.htm

Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.