Tuesday, April 17, 2012

Lookup button in Visualforce Page

Example 1:
 <apex:page standardController="Contact">
<apex:inputField value="{!contact.account}"/>
</apex:page>
Example 2:
Apex Class:
public class con {
    public contact c { get; set; }
    public con() {
        c = new contact();
    }
    public void search() {
        // c.accountid has the selected ID.
    }
}
VisualForce Page:
<apex:page controller="con">
   <apex:form>
     <apex:pageblock>
       <apex:pageblocksection>
          <apex:inputfield value"{!c.accountid}"/>
       </apex:pageblocksection>
    </apex:pageblock>
   </apex:form>
</apex:page>

No comments:

Post a Comment