function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC16SFDC16 

apex:repeat tag not working with list of object

Hello,
Data not displaying in vf page for the below code .
 public String caseId{get;set;}
*--------Controller--------------*
             public  List<Case> casListId{get; set;}
                  
             public void getDetails()
             {
              //String caseId= System.currentPageReference().getParameters().get('row_id');
                     casListId=new List<Case>();
                     System.debug('Case ID'+caseId);                    
                     casListId=[Select id,CaseNumber from Case where Id ='5007F00000K8gwH'];
                     System.debug('casListId'+casListId);
                  //   return null;
             }
           *----------Vf Page---------*  
<apex:form >
           <apex:pageBlock >
              <table class="Table">
               
                     <apex:repeat value="{!casListId}" var="a" >
                        <tr>
                       <td> <apex:outputText value="{!a.CaseNumber}"/></td>  
                        </tr>
                     </apex:repeat>
               </table>      
             </apex:pageBlock>        
           </apex:form>
NagendraNagendra (Salesforce Developers) 
Hi,

Please refer to the below link from the forums community with a similar discussion which might help you further with the above issue. Please let us know if this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra
Akshay_DhimanAkshay_Dhiman
Hi Sfdc,

try this code Its working fine.
 
<apex:page Controller="Controller_case">  
    <html>
        <head>
            <style>
                
            </style>
        </head>
        <body>
            <apex:pageBlock>
                <apex:pageBlockSection columns="1">  
                    <apex:form>
                        <apex:repeat value="{!casList}" var="record">
                            <table border = "1" cellpadding = "5" cellspacing = "5">
                                <tr>
                                    <th>CaseNumber</th>
                                </tr>
                                <tr>
                                    <td><apex:outputText value="{!record.CaseNumber}"/></td>                                    
                                </tr>
                            </table>
                            <br/>
                        </apex:repeat>
                    </apex:form>
                </apex:pageBlockSection>
            </apex:pageBlock>
        </body>
    </html>
</apex:page>


public class Controller_case {
 public  List<Case> casList{get; set;}
 public Controller_case(ApexPages.StandardController con)
    {
  //String caseId= System.currentPageReference().getParameters().get('row_id');
  System.debug('Case ID'+caseId);
  casList=new List<Case>();                                                      
  casList=[Select id,CaseNumber from Case where Id ='5007F00000K8gwH'];
  System.debug('casListId'+casListId);
 }
      
}



if you found this answer helpful then please mark it as best answer so it can help others.   
  
  Thanks 
  Akshay
SFDC16SFDC16
Hello All, I am calling this method on command link, On-click command link I want to displaying values on table *-------------Controller----------------------------* public String caseId{get;set;} public List casListId{get; set;} public void getDetails() { //String caseId= System.currentPageReference().getParameters().get('row_id'); casListId=new List(); System.debug('Case ID'+caseId); casListId=[Select id,CaseNumber from Case where Id =:caseId]; System.debug('casListId'+casListId); // return null; } *----------Vf Code -------------------*/
Akshay_DhimanAkshay_Dhiman
Please try this code Its working fine.
 
<apex:page Controller="Controller_case">  
    <html>
        <head>
            <style>
                
            </style>
        </head>
        <body>
            <apex:pageBlock>
                <apex:pageBlockSection columns="1">  
                    <apex:form>
                        <apex:repeat value="{!casList}" var="record">
                            <table border = "1" cellpadding = "5" cellspacing = "5">
                                <tr>
                                    <th>CaseNumber</th>
                                </tr>
                                <tr>
                                    <td><apex:outputText value="{!record.CaseNumber}"/></td>                                    
                                </tr>
                            </table>
                            <br/>
                        </apex:repeat>
                    </apex:form>
                </apex:pageBlockSection>
            </apex:pageBlock>
        </body>
    </html>
</apex:page>


public class Controller_case {
    public  List<Case> casList{get; set;}
    public Controller_case(ApexPages.StandardController con)
    {
        //String caseId= System.currentPageReference().getParameters().get('row_id');
        System.debug('Case ID'+caseId);
        casList=new List<Case>();                                                      
        casList=[Select id,CaseNumber from Case where Id ='5007F00000K8gwH'];
        System.debug('casListId'+casListId);
    }
      
}



if you found this answer helpful then please mark it as best answer so it can help others.      
  
  Thanks 
  Akshay
  
 
SFDC16SFDC16
Hello All,
It's not working,​ Data not displaying on table I am getting blank page User-added image
mukesh guptamukesh gupta
Hi,

Please use this code with command button :-
 
<apex:page Controller="Controller_case">  
    <html>
        <body>
        
            <apex:pageBlock >
                <apex:pageBlockSection columns="1">  
                    <apex:form >
                    <apex:commandButton action="{!save}" value="Save" id="save"/>
                        <apex:repeat value="{!casList}" var="record">
                            <table border = "1" cellpadding = "5" cellspacing = "5">
                                <tr>
                                    <th>CaseNumber</th>
                                </tr>
                                <tr>
                                    <td><apex:outputText value="{!record.CaseNumber}"/></td>                                    
                                </tr>
                            </table>
                            <br/>
                        </apex:repeat>
                    </apex:form>
                </apex:pageBlockSection>
            </apex:pageBlock>
        </body>
    </html>
</apex:page>
 
public class Controller_case {

    public PageReference save() {
    casList=new List<Case>();                                                      
        casList=[Select id,CaseNumber from Case where Id ='5007F00000K8gwH'];

        return null;
    }


    public Controller_case() {

    }

     public  List<Case> casList{get; set;}
    public Controller_case(ApexPages.StandardController con)
    {
             }

}
if you need any assistanse, Please let me know!!


Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh