You need to sign in to do that
Don't have an account?
suresh143
how to display values dynamically to picklist
<apex:page controller="Boss" >
<apex:form >
<apex:pageBlock title="Get Accnames" >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputPanel >AccNames:</apex:outputPanel>
</apex:pageBlockSectionItem>
<apex:selectList multiselect="FAlse" size="1"></apex:selectList>
<apex:selectOptions value="{!AccNames}"></apex:selectOptions>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public with sharing class Boss {
public String AccNames { get; set; }
List<SelectOption>Options=new List<SelectOption>();
public List<SelectOption>getAccNames(){
for(Account Acc:[select id,name From Account])
Options.add(new selectOption(Acc.name,Acc.name));
return Options;
}
}
The Account name values dosent get that pick list plase share me with answer.
Thank for advance!!
<apex:form >
<apex:pageBlock title="Get Accnames" >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputPanel >AccNames:</apex:outputPanel>
</apex:pageBlockSectionItem>
<apex:selectList multiselect="FAlse" size="1"></apex:selectList>
<apex:selectOptions value="{!AccNames}"></apex:selectOptions>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public with sharing class Boss {
public String AccNames { get; set; }
List<SelectOption>Options=new List<SelectOption>();
public List<SelectOption>getAccNames(){
for(Account Acc:[select id,name From Account])
Options.add(new selectOption(Acc.name,Acc.name));
return Options;
}
}
The Account name values dosent get that pick list plase share me with answer.
Thank for advance!!
Try the below link.
https://developer.salesforce.com/blogs/developer-relations/2008/12/using-the-metadata-api-to-retrieve-picklist-values.html
thanks,
RAmesh
thanks,
RAmesh
In pleace of: public String AccNames { get; set; }
use: public String AccName { get; set; }
in controller
public String AccNames { get; set; }
or chage the below.
thanks,
Ramesh
Let me know if it is not working...