<apex:page Controller="Listbox">
<apex:form >
<left>
<apex:pageBlock >
<b>Category: </b>
<apex:selectList value="{!ctgry}" size="1">
<apex:selectOptions value="{!ctgrys}"/>
</apex:selectList>
</apex:pageBlock>
</left>
</apex:form>
</apex:page>
{
public String[] ctgry = new String[]{};
public Listbox()
{
}
public List<SelectOption> getCtgrys()
{
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('India','India'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('United States','US'));
return options;
}
public String[] getCtgry()
{
return ctgry;
}
public void setCtgry(String[] ctgry)
{
this.ctgry = ctgry;
}
}
No comments:
Post a Comment