0

I got the following list of integer SelectOptions, and I want to add a String value to the SelectOption list. How can I convert String to Integer to add the String value?

'recordLimit' is an integer value I have declared in the controller.

Any help on this is appreciated.

<apex:pageBlockSectionItem rendered="{!isBuildReport}" >
                    <apex:outputLabel value="Record Limit" />
                    <apex:selectList value="{!recordLimit}" size="1" multiselect="false" >
                        <apex:selectOption itemValue="10" itemLabel="10" />
                        <apex:selectOption itemValue="50" itemLabel="50" />
                        <apex:selectOption itemValue="100" itemLabel="100" />
                        <!-- <apex:selectOption itemValue="All" itemLabel="All" /> -->
                    </apex:selectList>
                </apex:pageBlockSectionItem>
1

If in All, you want a sumatory of all values you can use that

<apex:pageBlockSectionItem rendered="{!isBuildReport}" >
                <apex:outputLabel value="Record Limit" />
                <apex:selectList value="{!recordLimit}" size="1" multiselect="false" >
                    <apex:selectOption itemValue="10" itemLabel="10" />
                    <apex:selectOption itemValue="50" itemLabel="50" />
                    <apex:selectOption itemValue="100" itemLabel="100" />
                    <!-- <apex:selectOption itemValue="160" itemLabel="All" /> -->
                </apex:selectList>
            </apex:pageBlockSectionItem>
  • What is different in your code? – BarCotter Mar 30 '15 at 9:34
  • @BarCotter difference is he has given a itemValue to the String itemLabel – Tinkerbell Mar 30 '15 at 9:39
  • The only difference I can see is that you changed itemValue="ALL" to itemValue="160" in the line that is commented out. – BarCotter Mar 30 '15 at 9:46
  • Yes, I had the issue in that line so that's why it was commented out. Tried with Torsen's solution and it works fine ! – Tinkerbell Mar 30 '15 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.