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
Amol DixitAmol Dixit 

How to provide Pagination to VF page

Hi !



I wants to provide pagination to my Visual force page. How can I provide that??



VF Page:


<apex:page controller="CRUDModuleController">
<apex:form id="form">
<apex:pageBlock title="Modules">
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlockButtons location="top">
<apex:commandButton value="New" action="{!addNew}"/>
<apex:pageBlockTable value="{!moduleList}" var="row">
<apex:column >
<apex:outputLink title="" value="/apex/editModule" style="font-weight:bold">Edit <apex:param name="msg" value="{!row.Name}"/></apex:outputLink>&nbsp;|&nbsp;
 <a href="javascript&colon;if (window.confirm('Are you sure?')) DeleteAccount('{!row.Id}');" style="font-weight:bold">Del</a>
<apex:column value="{!row.Name}"/>
<apex:column headerValue="Module Name">
 <apex:outputLink value="/apex/DetailModule" >
                        <apex:outputField value="{!row.Name__c}"/>
                         <apex:param name="msg" value="{!row.Name}"/>

<apex:actionFunction action="{!DeleteAccount}" name="DeleteAccount" reRender="form" >
<apex:param name="accountid" value="" assignTo="{!selectedModuleId}"/>



VF Class:

public class CRUDModuleController {

public List<module__c> moduleList { get; set; }

public string selectedModuleId { get; set; }

public CRUDModuleController() {


private void LoadData() {
moduleList = [Select id,name,Name__c from module__c];

public void DeleteAccount()
if (selectedModuleId == null) {


module__c tobeDeleted = null;
for(module__c a : moduleList)
if (a.Id == selectedModuleId) {
tobeDeleted = a;

if (tobeDeleted != null) {
Delete tobeDeleted;


public Pagereference addNew()
PageReference ref=new PageReference('/apex/addModule');
return ref;




Thank you !



Amol Dixit.

Best Answer chosen by Admin (Salesforce Developers)