You need to sign in to do that
Don't have an account?
dev rana 10
Get all record of custome filed in select list.
Hello all i m new in salesforce i m trying to all my records of coustome object in slect list.. i writen my code and pass query but i m not getting any record in select list. plese give some guidence
this is my controller
public class bill{
public String billOptions{ get; set;}
public String selectedVal { get; set;}
public List<SelectOption> getbillOptions(){
List<selectOption> options = new List<selectOption>();
for(devrana__Food_Menu__c menu : [SELECT devrana__Menu_Name__c from devrana__Food_Menu__c]){
options.add(new SelectOption(menu.devrana__Menu_Name__c,String.valueOf (menu.devrana__Menu_Name__c)));
}
return options;
}
}
This is my VF Page.
<apex:page controller="bill">
<apex:form >
<apex:selectList value="{!billOptions}">
<apex:selectOptions value="{!billOptions}" />
</apex:selectList>
</apex:form>
</apex:page>
this is my controller
public class bill{
public String billOptions{ get; set;}
public String selectedVal { get; set;}
public List<SelectOption> getbillOptions(){
List<selectOption> options = new List<selectOption>();
for(devrana__Food_Menu__c menu : [SELECT devrana__Menu_Name__c from devrana__Food_Menu__c]){
options.add(new SelectOption(menu.devrana__Menu_Name__c,String.valueOf (menu.devrana__Menu_Name__c)));
}
return options;
}
}
This is my VF Page.
<apex:page controller="bill">
<apex:form >
<apex:selectList value="{!billOptions}">
<apex:selectOptions value="{!billOptions}" />
</apex:selectList>
</apex:form>
</apex:page>
Please update your page like below:
I Do That but still not geting any single record.
public class bill{
public String billOptions1{ get; set;} // Give some different name to this.
public String selectedVal { get; set;}
public List<SelectOption> getbillOptions(){
List<selectOption> options = new List<selectOption>();
for(devrana__Food_Menu__c menu : [SELECT devrana__Menu_Name__c from devrana__Food_Menu__c]){
options.add(new SelectOption(menu.devrana__Menu_Name__c,String.valueOf (menu.devrana__Menu_Name__c)));
}
return options;
}
}
no i m getting all my records Thanks for your help