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
Matjaz GercarMatjaz Gercar 

pageBlockTable not showing any records

Hey all!
I am new in Salesforce development. I am trying to show all records in my own object, but all that I get is empty table with headers. 
I suppose there is something wrong with calling my object's records. This is my code:

<apex:pageBlock title="Students">
       <apex:pageBlockTable value="{!tudent__c}" var="all_students">
          <apex:column value="{!all_students.Name__c}"/>
          <apex:column value="{!all_students.Surname__c}"/>
          <apex:column value="{!all_students.Address__c}"/>
       </apex:pageBlockTable>
   </apex:pageBlock>

I can't find the reason why is empty, so any helping clue is great:) 
Best Answer chosen by Matjaz Gercar
RKSalesforceRKSalesforce
Use Below code, It should work:
<apex:page standardController="Student__c" recordSetVar="students">
  <apex:pageBlock title="Students">
       <apex:pageBlockTable value="{!students}" var="all_students">
          <apex:column value="{!all_students.Name__c}"/>
          <apex:column value="{!all_students.Surname__c}"/>
          <apex:column value="{!all_students.Address__c}"/>
       </apex:pageBlockTable>
   </apex:pageBlock>
</apex:page>

Please mark it as a best answer if helped.

Regards,
Ramakant

All Answers

RKSalesforceRKSalesforce
Use Below code, It should work:
<apex:page standardController="Student__c" recordSetVar="students">
  <apex:pageBlock title="Students">
       <apex:pageBlockTable value="{!students}" var="all_students">
          <apex:column value="{!all_students.Name__c}"/>
          <apex:column value="{!all_students.Surname__c}"/>
          <apex:column value="{!all_students.Address__c}"/>
       </apex:pageBlockTable>
   </apex:pageBlock>
</apex:page>

Please mark it as a best answer if helped.

Regards,
Ramakant
This was selected as the best answer
RKSalesforceRKSalesforce
Also, I  think there is a error on (spelling) mistek:
<apex:pageBlockTable value="{!tudent__c}" var="all_students">
Matjaz GercarMatjaz Gercar
Hey! 
recordSetVar it is. Hm. I am trying to figure out the reason, why I need it, since this code is from Trailhead. I suppose I store dataset into this variable? Or is there any other reason? And is it possible to work without this variable?
Matjaz GercarMatjaz Gercar
Ok, new problem now. I also have a form to enter data in the same page. If I use recordSetVar, the form no longer is writing data into the object.There is no error, everything looks fine, just no data are stored into database.