+ Start a Discussion
ramakrishna236ramakrishna236 

dropdown list in menuitem

i am having one dought

             when i clink on menu it will shows menu items and select any item it will redirect to another one Ex:like in salesforce.com when click on setup and below shows like developerconsole and logout

Best Answer chosen by Admin (Salesforce Developers) 
BondicloudBondicloud

whenever u click any one value in drop down by using apex:actionsuppot  u call one metthod and in controller  based  on conditions u prepare list<selectoptions> and u display in UI.  bu using apex:selectOptions value="{!items}"

All Answers

BondicloudBondicloud

whenever u click any one value in drop down by using apex:actionsuppot  u call one metthod and in controller  based  on conditions u prepare list<selectoptions> and u display in UI.  bu using apex:selectOptions value="{!items}"

This was selected as the best answer
login.developerlogin.developer

please send some code how to create drop down list like menu type on custom object

BondicloudBondicloud

    public List<SelectOption> getitems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('US','US'));
            options.add(new SelectOption('CANADA','Canada'));
            options.add(new SelectOption('MEXICO','Mexico'));
           
            return options;
            }

 

 

 

or  through for loop

 

 

   optList= new List<selectoption>();
        NarList=[select n.Id,n.companyName__c from NarayanaForm__c n];
        System.debug('NarList values :'+NarList);
        Selectoption sOption = new Selectoption('','--None--');

        optList.add(sOption);
        System.debug('none option vaue optList:'+optList);
        for(NarayanaForm__c nar1 :NarList){            
            selectoption s = new selectoption(nar1.Id,nar1.companyName__c);
            optList.add(s);
            //System.debug('NarList optList:'+optList);
        }