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
SKT CloudComputingSKT CloudComputing 

Issue with wrapper class.

VF Page-

<!----------- Creating this page for dispaly Opportunity fields object in single table with check box ---------->

<apex:page controller="WrapperIntStringDisplayClass">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection >
                <apex:pageBlockTable value="{!lstwrapperIntString}" var="w">
                    <apex:column headervalue="click2Select">
                        <apex:inputcheckbox />
                    </apex:column>
                    <apex:column headervalue="Opportunity fields">
                        {!w.Id}
                        {!w.Name} 
                        {!w.Amount}                  
                    </apex:column>    
                </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Apex Class-

public with sharing class WrapperIntStringDisplayClass {
    public List<wrapper> lstwrapperIntString {get;set;}
    
    public WrapperIntStringDisplayClass(){
        lstwrapperIntString = new List<wrapper>();
        for(opportunity opp : [select Id, Name,Amount from opportunity]){
            lstwrapperIntString.add(new wrapper(opp.Id,opp.Name,opp.Amount));
        }
    }
    //Wrapper Class Construction

    public class wrapper{
         public String Id{get;set;}
         public String Name{get;set;}
          public Double Amount{get;set;}
    // Wrapper class constructor
    public wrapper(String Id,String Name,Double Amount ){
        this.Id=Id;
        this.Name=Name;
        this.Amount=Amount;
        }  
    }
}

I am getting Below error-

[Error] Error: WrapperIntStringDisplayClass Compile Error: Constructor not defined: [WrapperIntStringDisplayClass.wrapper].<Constructor>(Id, String, Decimal) at line 7 column 37


Can anyone help in this.
Best Answer chosen by SKT CloudComputing
SKT CloudComputingSKT CloudComputing
Sorry folks. I found my mistake I corrected the datatype.

 public wrapper(String Id,String Name,Decimal Amount )

 public Decimal Amount{get;set;}

It works now.