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
Arun ChaubeyArun Chaubey 

Create a VF Page to Show Contact

Hi Friend,
I have a task to create a Visualforce Page that shows all contacts (say 50) with Email IDs
  • The page should show 5 contacts at a time
  • Pagination should be done. So there will be 50/5 = 10 pages
  • Each of the pages should have First, Previous, Next, Last as links
  • Each page should be numbered (Page 1, Page 2,....) 
  • Column Shoul be First Name, Last Name, Mobile, State, Email ID
Now my question is How to fetch all contacts and show it on a page, I have done this by 
<apex:pageBlockTable value="{!Contact}" var="item">
but this shows only the field lable name, No value is getting papulated.
My Second question is I am not able to add columns for State and Mobile. It shows error - Error: Invalid field States for SObject Contact
I used this code for it - <apex:column value="{! item.State}"/>
My third Question is how to add Pagination on my page like first, last, next, and previous buttons.