I would like to show Accounts and Related Contacts in a Picklist.
public class mappingaccount1 {
public List<SelectOption> mapcon { get; set; }
public List<Contact> mapcon { get; set; }
public Map<Account, List<Contact>> mapconn { get; set; }
public mappingaccount1(){
mapconn = new Map<Account, List<Contact>>();
List<Account> lstacc= [SELECT Id, Name, (SELECT Id, Name FROM Contact) FROM Account];
for(Account a : lstacc) {
List<SelectOption> mapcon = [SELECT id,name FROM Contact WHERE AccountId =:a.id];
mapcon.put(a,lstcon);
}
}
}