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 Post

Show Custom And Standard Object

Check Duplicate EmailId when user Insert the Contact

Fetch Picklist value in LWC using Schema class