1

I have following code

VF Page:

< apex:page controller="DisplayBooks">  
< apex:form >  
    < apex:selectList value="{!selectedVal}" size="1">   
    < apex:selectOptions value="{!openPresentationOptions}" />  
< /apex:selectList>  
< /apex:form>  
< /apex:page>  

Class:

public class DisplayBooks {  

    public String openPresentationOptions { get; set; }

    public String selectedVal { get; set; }       

    public List<SelectOption> getopenPresentationOptions(){    

         List<selectOption> options = new List<selectOption>();           

        for(Books__c book : [SELECT Id,Name__c FROM Books__c]){

            options.add(new SelectOption(book.Id,book.Name__c));
        }
        return options;
    }    
}

2 Answers 2

2

May be VF is getting the openPresentationOptions string, rather than getopenPresentationOptions()

try changing getopenPresentationOptions() to like getPresentationOptions()

and then change VF page to < apex:selectOptions value="{!PresentationOptions}" />

1
  • Thaks for help...its working
    – Vivek C
    Commented Sep 23, 2015 at 12:55
1

I think you should remove this line from apex class.

public String openPresentationOptions { get; set; }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .