Visualforce page code
<apex:page controller="threeobjects">
<apex:pageBlock >
<apex:form >
<apex:inlineEditSupport />
<apex:pageBlockSection columns="3" >
<apex:pageBlockTable value="{!accountname}" var="a">
<apex:column headerValue="Accounts" >
<apex:outputField value="{!a.name}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!contactname}" var="c">
<apex:column headerValue="Contacts" >
<apex:outputField value="{!c.name}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!opportunityname}" var="o">
<apex:column headerValue="Opportunities" >
<apex:outputField value="{!o.name}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:commandButton value="Save" action="{!save}"/>
</apex:form>
</apex:pageBlock>
</apex:page>
Controller
public class threeobjects {
public list<account> accountname{get; set;}
public list<contact> contactname{get;set;}
public list<opportunity> opportunityname{get; set;}
public threeobjects(){
accountname = [select name from account limit 10];
contactname = [select name from contact limit 10];
opportunityname = [select name from opportunity limit 10];
}
public PageReference save() {
update accountname;
update contactname;
update opportunityname;
return null;
}
}
Helpful!
ReplyDelete