+ Start a Discussion
RavitejaRaviteja 

How to Display list of Sobject in visualforce

I wrote some code but unable to display in vf

 

vf:

-------------------------------------------

<apex:pageBlockTable value="{!get}" var="get_var" rendered="{!get_ren}">
             <apex:column value="{!get_var.name}"/>
            
            </apex:pageBlockTable>

 

class:

-------------------------------------------

list<SObject> selrec= new list<SObject>();

 accrec=[select id,name,check__c from account limit 10];

 conrec=[select id,lastname,check__c from contact limit 10];

 public PageReference Addtoselectedlist() {
       get_ren=true;
       for(account a:accrec){
         if(a.check__c==true){
         selrec.add(a);
         }
       }
       for(contact c:conrec){
         if(c.check__c==true){
         selrec.add(c);
         }
        
    }
 
return null;
}
     public sobject[] getGet() {
        return selrec;
    }

hemantgarghemantgarg

You can try by changing the name of your list variable , I guess. Also chck the the value of boolean variable get_ren .