function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ashish jadhav 9ashish jadhav 9 

how to display picklist on vf page

Ajay Nagar 7Ajay Nagar 7
To display picklist values in Visualforce page,you can use <apex:outputfield value=”{!Object__c.Field__c}” />

==============================================================================

For custom Picklist :
public List<SelectOption> getCountriesOptions() {
        List<SelectOption> countryOptions = new List<SelectOption>();
        countryOptions.add(new SelectOption('','-None-'));
        countryOptions.add(new SelectOption('INDIA','India'));
        countryOptions.add(new SelectOption('USA','USA'));
        countryOptions.add(new SelectOption('United Kingdom','UK'));
        countryOptions.add(new SelectOption('Germany','Germany'));
        countryOptions.add(new SelectOption('Ireland','Ireland'));
 
        return countryOptions;
    }
 
<apex:selectList value="{!selectCountry}" multiselect="false" size="1">
                <apex:selectOptions value="{!countriesOptions}"/>
</apex:selectList>

 
Sudha#aSudha#a
visual force pages :--
<apex:page controller ="customlistpicklistvalues" >
     <apex:pageblock >
         <apex:pageblocksection>
             <apex:selectedlist value="{!selectedone}">
                <apex:selectedoption iteamvalue="India" iteamlabel="india"/>
                <apex:selectedoption iteamvalue="usa" iteamlabel="usa"/>
               <apex:selectedoption iteamvalue="canada" iteamlabel="canada"/>
              <apex::selectedoption iteamvalue="southindia" iteamlabel="southindia"/>
</apex:selectedoptions>
</apex selectedlist>
</apexpageblocksection>
</apex:pageblock>
</apex:page>
  

apex-class::::-----

public class customlistpicklistvalues

  public customlistpicklistvalues()
{
public list<selectedoption > get selecteddone()
{
list<selectedoption > selecteddone = new list<selectedoption > ();
selectedone.add(new selectoption ("india", "india"));
'''
''''

'''

'''
}
return selectedone ;
}
}
}