+ Start a Discussion
sreedharp286sreedharp286 

Compile Error: Constructor not defined: [selectoption].<Constructor>(String, String) at line 9

Hi,

 

<apex:page Controller="selectst" >
<apex:form >
<apex:selectList value="{!str}">
<apex:selectOptions value="{!values}" />





</apex:selectList>

</apex:form>
</apex:page>

 

 

 

Controller :--------------

public class selectst {


public List<SelectOption> getValues() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}

 

public string str {get;set;}

}

 

Can any one help me?

 

Satyendra RawatSatyendra Rawat

Hi,

 

Update your controller code :)

 

public class selectst {

public string str {get;set;}

 

public selectst ()

{

}
public List<SelectOption> getValues() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}

 

}

 

sreedharp286sreedharp286

No, it's not working 

 

i also tryed with same constructor , but i couldn't resolve issue.

 

Let me know if there is any another way

RoshRosh

Your code seems to be correct. Infact I copy pasted your code in my org and I didn't get any exception.

Satyendra RawatSatyendra Rawat

hi, 

update bf page

 

<apex:selectList value="{!str}" multiselect="false" size="1">