You need to sign in to do that
Don't have an account?
rajesh k 10
Without Using get method how display picklist values?
Hi,
Using get method I displayed.Without using get method same how to display Picklist values
Controller:
==========
Using get method I displayed.Without using get method same how to display Picklist values
<apex:selectList value="{!selectedPicebookIds}" size="1"> <apex:selectOptions value="{!PricebookNames}" /> <apex:actionSupport event="onchange" reRender="bundle,allsections,errormesg" status="status" /> <apex:actionstatus id="status"> <apex:facet name="start"> <div class="waitingSearchDiv" id="el_loading" style="background-color: #fbfbfb; height: 100%;opacity:0.65;width:100%;"> <div class="waitingHolder" style="top: 74.2px; width: 91px;"> <img class="waitingImage" src="/img/loading.gif" title="Please Wait..." /> <span class="waitingDescription">Please Wait...</span> </div> </div> </apex:facet> </apex:actionstatus> </apex:selectList> <br/> <br/> Bundle <apex:selectList value="{!selectedBundleId}" size="1" id="bundle"> <apex:selectOptions value="{!BundleNames}" /> <apex:actionSupport id="adOnProductType" event="onchange" status="status1" rerender="allsections,errormesg" /><!-- rerender="adOnInfo,errormesg,IncludedProInfo,product" /> --> <apex:actionstatus id="status1"> <apex:facet name="start"> <div class="waitingSearchDiv" id="el_loading" style="background-color: #fbfbfb; height: 100%;opacity:0.65;width:100%;"> <div class="waitingHolder" style="top: 74.2px; width: 91px;"> <img class="waitingImage" src="/img/loading.gif" title="Please Wait..." /> <span class="waitingDescription">Please Wait...</span> </div> </div> </apex:facet> </apex:actionstatus> </apex:selectList>
Controller:
==========
public List < SelectOption > getPricebookNames() { pricebookid = opp.Pricebook2Id; List < SelectOption > Options = new List < SelectOption > (); pricebookList = [select Id, name FROM Pricebook2 WHERE Id = : pricebookid]; if (pricebookid != NULL) { for (Pricebook2 price: pricebookList) { if (price.id == Opp.Pricebook2Id) { Options.add(new SelectOption(Opp.Pricebook2Id, price.name)); getBundleNames(); } } } else { Options.add(new SelectOption('', '--Select--')); pricebookList1 = [select Id, name FROM Pricebook2]; System.debug(pricebookList1); for (Pricebook2 price1: pricebookList1) { Options.add(new SelectOption(price1.Id, price1.name)); getBundleNames(); } } return Options; } public List < SelectOption > getBundleNames() { List < SelectOption > bundleOptions = new List < SelectOption > (); System.debug(pricebookid); if (pricebookid != NULL) { bundleList = [select Id, name, Price_Book__c FROM Bundle__c WHERE Price_Book__c = : pricebookid]; System.debug(bundleList); bundleId = bundleList[0].Id; if (bundleList.size() > 0) { for (Bundle__c bundle: bundleList) { bundleOptions.add(new SelectOption(bundle.Id, bundle.name)); } BundlePopulatedRecordsMethod(); } else { bundleOptions.add(new SelectOption('', '--Select--')); } }help me...
public List < SelectOption > bundleNames {ge;set;}
and then in constructor you could add options to it similarly youhave done in get method.