I am beginner to salesforce. I want to add row dynamically to VF page when i clicked add row button.

this is my script

<apex:page standardController="Employee__c"  extensions="Cutomextension">
   <apex:form >
      <apex:pageBlock >
         <apex:pageBlockTable value="{!Employee__c}" var="emp">
            <apex:column headerValue=" Employee Name">
               <apex:inputField value="{!emp.name}"/>
         <apex:commandButton action="{!add}" value="Add Row"/>


public with sharing class Cutomextension {

    public Employee__c emp {get; set;}
    public List<Employee__c> empList {get; set;}
    public static Integer addCount {get; set;}

    public Cutomextension(ApexPages.StandardController controller) {
        this.emp = (Employee__c)Controller.getRecord();
        empList = new List<employee__c>();

    public void add() {
        empList.add(new employee__c());

When i clicked add row button, new row doesn't get added. Can anyone tell me what is wrong with my code.

1 Answer 1


As I understand you want to show a list of records in your page. Please read the following articles about showing a set of records in a pages and try to code it for your case.

  • I checkd with all the functionality but its not working.Is I need to use wrapper class here???
    – Mubarakkk
    Commented Feb 18, 2015 at 8:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .