I have a list of products with their prices and I would like to be able to apply discounts to each product, but I'm not able to get the discount and the row number when clicking the button. I get an error that says: "Argument cannot be null."

List of products

This is my Visualforce page code:

    <apex:pageBlock id="pagBlock1" rendered="{!IsValidConfiguration}" >                    
         <apex:variable var="rowNum" value="{!0}"/>
        <apex:pageBlockSection title="Total revenues" columns="5">
             <apex:pageBlockTable value="{!PandL}" var="Item" id="list" >                   
                 <apex:column headerValue="rowNum">
                    <apex:outputText >                   
                <apex:column style="width:350px;" value="{!Item.Product_Name__c}" onclick="return false;"/>                 
                <apex:column style="width:250px;" headerValue="Total" value="{!Item.Total_revenue__c}">
                    <apex:facet name="footer">                          
                            <apex:outputText value="{!total_revenue}"/>                             
                <apex:column style="width:250px;" headerValue="One Off" value="{!Item.Revenue_NRC__c}"/>                  
                <apex:repeat value="{!column_years}" var="year" >
                    <apex:column style="width:250px;" headerValue="{!year}" value="{!Item.Revenue_MRC__c}" />
                 <apex:column style="width:250px;" headerValue="Discount">                       
                     <apex:inputtext value="{!Item.Discount__c}"  style="height:15px;width:25px">
                         <apex:commandButton value="Apply" action="{!rowNumber}">  
                              <apex:param value="{!rowNum}" name="index"/>
                     <apex:variable var="rowNum" value="{!rowNum+1}"/>  


This is the method of the apex class

public pagereference  rowNumber() {

index = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
return null;


  • Probably you need to add rerender attribute to command button. – Raul May 7 at 10:50
  • you want to edit row then you need to use wrapper class and if you want to edit after discount price then you have to reRender the table and in controller you have to update the soql which is bind with this table – cloudZigZag May 7 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.