You need to sign in to do that
Don't have an account?

Visualforce custom picklist , System.TypeException: Invalid conversion from runtime type String to List<System.SelectOption>
Hi Can anyone help me to resolve this. I am getting this error in VF controller. I am creating a custom picklist in VF controller wrapper class and getting this
Error in debug while second run : System.TypeException: Invalid conversion from runtime type String to List<System.SelectOption>
sample code :
public class controller{
public class Wrapper
{
public boolean isCheck{get;set}
public List<SelectOption> Picklist{get;set;}
public String name{get;set;}
}
public List<wrapper> getwrapperlist()
{
return wrapperlist;
}
public void setwrapperlist()
{
this.wrapperlist=wrapperlist;
}
public void method1()
{
Wrapper w=new Wrapper();
w.addPicker=new List<selectoption>();
for(list<object> s:olist){
w.addPicker.add(new SelectOption (s.fname,s.fname));
}
wrapperlist.add(w);
}
}
I would recommend having a read up on the <apex:selectList> component help examples (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_selectList.htm)
All Answers
I have formatted your code below. Could you check as some of it seems incorrect:
Hi pbattisson
Olist is having some string values (fname) which I have to add to the picklist to disply. here is the formatted code.
i am sending 'wrapperlist' to display in vf page .
I would recommend having a read up on the <apex:selectList> component help examples (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_selectList.htm)
It's working properly in first run. In second run (when I click Next) it should get the another fname data from olist and create another picklist to rerender on page. .
Exception in debug :
Hi pbattisson,
Thank you very much for quick response. Now Working perfectly
hey I am also getting same error..can u please explain how to slove this..please
Thanks
Vamsi Krishna