I am getting the following Error:

Error: Selectpick Compile Error: Constructor not defined: [Selectoption].(String, String) at line 7 column 16

VF Page:

<apex:page controller="Selectpick">
<apex:form >
    <apex:selectlist value="{!sv}">
        <apex:selectOptions value="{!options}"/>

Apex Class:

public class Selectpick{
    public List<selectoption> getOptions() {
        List<selectoption> ls= new List<selectoption>();
        ls.add(new selectoption('none','--select--'));

        return ls;

    public String sv { get; set; }
  • Recompile or delete and save .It got compiled and saved and working in my org . – Mohith Shrivastava Dec 5 '13 at 13:55

Do you have a class called "SelectOption"? If so, it is shadowing the default system class. You may need to refer to it as System.SelectOption instead.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.