Type 3:Usage of picklist in vf & Apex

Exapme: Creating Picklist In Visualforce Page itself

<apex:page controller="zvf5" sidebar="false" showHeader="false">
 <apex:form >
   <apex:selectList value="{!myVal}" size="3" multiselect="true">
     <apex:selectOption itemvalue="One" itemlabel="1"/>
     <apex:selectOption itemvalue="Two" itemlabel="2"/>
     <apex:selectOption itemvalue="Three" itemlabel="3"/>
     <apex:selectOption itemvalue="Four" itemlabel="4"/>
     <apex:selectOption itemvalue="Five" itemlabel="5"/>
        <apex:actionSupport event="onchange" reRender="one"/>
   </apex:selectList>
   <br/>
   <apex:outputLabel id="one">
      <b>The selected value is : {!myVal} </b>
   </apex:outputlabel>
   </apex:form>
 </apex:page>

Controller:

public class zvf5 {

public String myVal { get; set; }
}

one

Advertisements

One thought on “Type 3:Usage of picklist in vf & Apex

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s