You need to sign in to do that
Don't have an account?
❤Code
Incompatible element type Set<String> for colection of System.SelectOption
How to assign a set to List... I am getting the following error ..
Incompatible element type Set for collection of System.SelectOption.
Regards
Incompatible element type Set for collection of System.SelectOption.
public List<SelectOption> cpOptions { get { if (cpOptions== null) { cpOptions = new List<SelectOption>(); } return cpOptions ; } set; } public Set<String> cpOptions1{ get { if (cpOptions1== null) { cpOptions1= new Set<String>(); } return cpOptions1; } set; } cpOptions.add(cpOptions1); cpOptions1.add(cp1.Emp__c);
Regards
You instantiate a SelectOption in this way:
The first parameter represents the value that will be returned if that item is selected, the second parameter represents what will be displayed on the page.
So in your case, if you want the value of cp1.Emp__c as your select option you'd have to do:
Or, if you have a set of strings: