Get List of Year and Bind on Visual force Page using Apex Code

 public List<selectOption> lstSelectYear{get; set;}
 public string strSelectyear{get; set;}

 for(integer count = 2014; count <= currentYear ; count++)
        {
            lstSelectYear.Add(new SelectOption(string.valueof(count),string.valueof(count)));
            //lstSelectYear.Add(new SelectOption('2015','2015'));
        }    



Page

 <apex:pageBlockSection title="Year" rendered="{!boolIsShowCase}">
           <apex:selectList size="1" value="{!strSelectyear}" id="test">
                      <apex:selectOptions value="{!lstSelectYear}"></apex:selectOptions>
                      <!-- <apex:actionSupport action="{!ShowButton}" event="onchange" reRender="idMain" />-->
                  </apex:selectList>
           </apex:pageblockSection>



If any issue concert to me
Sumit Shukla
9711055997

Comments

Popular posts from this blog

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 201 Admin

Show Hyper Link On Add Error in Salesforce Trigger

Show the Success Message before Redirecting the Detail page on Visualforce Page