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>  


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;

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}" />

  • Thaks for help...its working – Vivek C Sep 23 '15 at 12:55

I think you should remove this line from apex class.

public String openPresentationOptions { get; set; }

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.