+ Start a Discussion
sfdc freshersfdc fresher 

what is the "value: in page block table in below code,,, getting uknowun property error

hi everyone,
 I have wrtten below code and i want to use this in vf page. inorder to call the list account records, what must the value that I have to use in Pageblock table value. Could anyone explain me please ???.
public class Pagination_Example_Account {
    public Apexpages.StandardSetController controler {set;get;}
    public Integer size {set;get;}
    
    public Pagination_Example_Account()
    {
        List<Account> acc=[select Id,name from Account];
        
        controler= new Apexpages.StandardSetController(acc);
        controler.setPageSize(5);
    }
    public List<Account> act()
    {
        List<Account> ac=(List<Account>)controler.getRecords();
        return ac;
    }

}
vf code::
<apex:page controller="Pagination_Example_Account">
    <apex:form>
        <apex:pageBlock>
        <apex:pageBlockTable value="{!accounts}" var="a">
            <apex:column value="{!a.name}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
<apex:page>
    
User-added image
Hemant_SoniHemant_Soni
Hi,
Please use below code.
public class Pagination_Example_Account {
    public Apexpages.StandardSetController controler {set;get;}
    public Integer size {set;get;}
public list<Account> accounts {get; set;}
    public Pagination_Example_Account()
    {
       accounts  =  [select Id,name from Account];
        controler = new Apexpages.StandardSetController(accounts);
        controler.setPageSize(5);
    }
    public List<Account> act()
    {
        List<Account> ac=(List<Account>)controler.getRecords();
        return ac;
    }

}
vf code::
<apex:page controller="Pagination_Example_Account">
    <apex:form>
        <apex:pageBlock>
        <apex:pageBlockTable value="{!accounts}" var="a">
            <apex:column value="{!a.name}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
<apex:page>
Thanks
Hemant
Narender Singh(Nads)Narender Singh(Nads)
Hi,

Use this code:
VF Page:
------------

<apex:page controller="Pagination_Example_Account ">
    <apex:form>
        <apex:pageBlock>
        <apex:pageBlockTable value="{!accounts}" var="a">
            <apex:column value="{!a.name}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
--------------
public class Pagination_Example_Account {
    
    public Apexpages.StandardSetController controler {set;get;}
    public Integer size {set;get;}
	public list<Account> accounts;
    public Pagination_Example_Account ()
    {
       accounts  =  [select Id,name from Account];
        controler = new Apexpages.StandardSetController(accounts);
        controler.setPageSize(5);
    }
    public List<Account> getaccounts()
    {
        List<Account> ac=(List<Account>)controler.getRecords();
        return ac;
    }

}