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
amar joshiamar joshi 

want to get more then 10 value in selectoptions through controller

hi all

now what i m doing here i have one string in variable like String s1 = 'salesforce'

now i m firing one quarry

select name from account where name = '"+s1+"' 

and i want to display that account name in to Selectoption component 

u can get better idea from code
Code:
///page code///
<apex:page controller="convert1" tabstyle="lead">
 <apex:selectlist value="{!list}" size="1" required="True">
 <apex:selectoption itemvalue="{!items}"/>

////controller//// 
public class convert1
{
  String s1;
    Lead name;
    public  list<account> getItems() {
    if(name == null)
     name = [select company from lead where id = :ApexPages.currentPage().getParameters().get('id')];
     s1=name.company;
      list<Account> ac = new account[]{};
      ac = [select name from account where name = '"+s1+"'];
      return ac;
      }
}

 
but i cant get into that listbox of selectoptioin component

please advise

Thanks & Regards
Amar joshi
Best Answer chosen by Admin (Salesforce Developers) 
visulaforcevisulaforce
Code:
public class convert1
{
  String s1;
    Lead name;
    public  list<account> getItems() {
    if(name == null)
     name = [select company from lead where id = :ApexPages.currentPage().getParameters().get('id')];
     s1=name.company;
      list<Account> ac = new account[]{};
      ac = [select name from account where name = '"+s1+"'];
      List<SelectOption> options = new List<SelectOption>();
      for(Integer i;i<=ac.size();i++)
 {
  options.add(new SelectOption(ac.name,ac.name));
 }
      return options;
      }
}

 
i think u need to add yr options into List od selectOption as mentioned above.