I've a button on VF page that call a delCount() method, declared in the controller, but I get error Unknown method delCount(). How is it possibile?


  <apex:page Controller="QuotationController" tabstyle="Opportunity" >
  <apex:form >
  <apex:pageBlock title="Quotation Template"> 
  <apex:pageBlockSection title="Available Starting Template">
  <apex:pageBlockTable value="{!ListaQuotation}" var="f">
  <apex:column value="{!f.Name}">   
 <apex:column value="{!f.Q_Product_Consultant_costs__c}">
<apex:column value="{!f.Q_Product_Program_Director_costs__c}">
 <apex:column value="{!f.Q_Product_Project_Manager_costs__c}">
<apex:column value="{!f.Q_Product_Senior_Graphic_Designer_costs__c}">
<apex:column value="{!f.Q_Products_total_costs__c}">
<apex:column >
            <apex:facet name="header"<Related Products</apex:facet>

                <apex:repeat value="{!f.Q_Products__r}" var="qp">
                    <li><apex:outputField value="{!qp.Product_Type__c}" /></li>                        

<apex:column >
<apex:commandButton value="Select" 
                    onclick="window.open('/{!f.Id}/e?clone=1'); return false;"/> 

  <apex:column headerValue="Action">
  <apex:commandButton value="Del" action="{!delCont}" rerender="all">
   <apex:param name="contIdParam" value="{!f.id}" assignTo="{!contIdChosen}"/>


 public virtual class QuotationController {
 public String contIdChosen {get; set;}
    public PageReference delCont() 
   Quotation__c toDel=new Quotation__c(id=contIdChosen);
  / /Quotation__c newcontact= new Quotation__c();
    //insert newContact;
    delete todel;
    return null;
   public Quotation__c myq {get; set;}
public QuotationController () {
    public List<Quotation__c> getListaQuotation() {
     return [select Id, Name, Q_Product_Consultant_costs__c, Q_Product_Program_Director_costs__c, Q_Products_total_costs__c,
   Q_Product_Project_Manager_costs__C, Q_Product_Senior_Graphic_Designer_costs__c, (SELECT Name, Product_Type__c
    from Q_Products__r)
                     from Quotation__c 
                     WHERE IsTemplate__c = true


  • Please post the entire code of the VF page & controller. Commented Jun 18, 2014 at 11:07
  • Are you sure there are no type errors or incorrect class name?
    – AslamK
    Commented Jun 18, 2014 at 11:07
  • post the complete class code, including the class name, since the issue is not with the method functionality, but rather with the visibility of method itself.
    – AslamK
    Commented Jun 18, 2014 at 11:11
  • I'm trying to post all code, please wait :)
    – user9959
    Commented Jun 18, 2014 at 11:15
  • 1
    I'm not sure why you are using a virtual class as the controller. Can you give it a try by changing it to public with sharing class QuotationController{} ?
    – highfive
    Commented Jun 18, 2014 at 11:23

1 Answer 1


Change your class definition from public virtual class QuotationController into public with sharing class QuotationController{}

  • thank you. I would have another question. how can I reference the fields of toDel Quotation? I have the id but if I try to reference its name , it will be just null.
    – user9959
    Commented Jun 18, 2014 at 12:31
  • First, if you found this as the answer make sure to mark it as the answer so that other contributors don't waste their time to answering already answered one. Community will give you values for being honest and keeping up the good work. Though it's an another question to be posted I think you are initializing toDel with only the Id of it as per your code. So none of other fields give you values. If you need to access other fields, when the toDel is initializing do it by populating other those fields as well.
    – highfive
    Commented Jun 18, 2014 at 18:42

You must log in to answer this question.