function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
<apex:page controller="RadioButtonController"> <apex:form > <apex:pageBlock title="Account Viewer" > <apex:pageBlockSection rendered="{!If(accounts !=null && accounts.size>0,true,false)}" > <apex:pageBlockTable value="{!accounts}" var="acc" width="100%" id="accTable" > <apex:column headerValue="Select"> <input type="radio" name="<strong>selectRadio</strong>" id= "radio" > <br/> <apex:actionSupport event="onclick" action="{!getSelected}" status="buttonStatus" reRender="cntblock" > <apex:param name="accid" value="{!acc.id}" /> </apex:actionSupport> </input> </apex:column> <apex:column value="{!acc.Name}"/> <apex:column value="{!acc.Type}"/> </apex:pageBlockTable> </apex:pageBlockSection> <!-- Action status block --> <apex:actionStatus id="buttonStatus"> <apex:facet name="start"> <apex:outputPanel > <apex:commandButton value="View Contact Records" disabled="true"/> </apex:outputPanel> </apex:facet> <apex:facet name="stop"> <apex:outputPanel > <apex:commandButton value="View Contact Records" action="{!viewContacts}" reRender="cntblock"/> </apex:outputPanel> </apex:facet> </apex:actionStatus> </apex:pageBlock> <!-- Contact Block --> <apex:outputPanel id="cntblock"> <apex:pageBlock title="Available Contacts" rendered="{!If(contacts != null && contacts.size>0,true,false)}"> <apex:pageblockSection > <apex:pageBlockTable value="{!contacts}" var="con" width="100%" id="cntTable"> <apex:column value="{!con.FirstName}"/> <apex:column value="{!con.LastName}"/> </apex:pageBlockTable> </apex:pageblockSection> </apex:pageBlock> <apex:pageMessage summary="No Contacts Found" severity="Info" strength="3" rendered="{!AND(contacts == null, selectedAccountId != null)}"/> </apex:outputPanel> </apex:form> </apex:page> public class RadioButtonController { public string selectedAccountId{get; set;} public List<Account> accounts{get; set;} public List<Contact> contacts{get; set;} public RadioButtonController() { accounts = [SELECT Name, Type FROM Account LIMIT 10]; } public PageReference getSelected() { System.debug('Entered account selection block'); selectedAccountId = ApexPages.currentPage().getParameters().get('accid'); contacts = new List<Contact>(); return null; } public void viewContacts() { if(selectedAccountId != null) { contacts = [SELECT FirstName, LastName FROM Contact WHERE AccountId =:selectedAccountId]; if(contacts.size() == 0) contacts = null; } } }
<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false"> <apex:pageBlock > <apex:repeat value="{!accounts}" var="a" > <apex:pageBlockSection title="{!a.name}" columns="1"> <apex:relatedList list="Contacts" subject="{!a.Id}" /> </apex:pageBlockSection> </apex:repeat> </apex:pageBlock> </apex:page>
try this code
if you found this answer helpful then please mark it as best answer so it can help others.
Thanks
Akshay
Example 2) With SOQL please check below post
1) https://developer.salesforce.com/forums/?id=906F0000000g0WzIAI
2) https://developer.salesforce.com/forums/?id=906F000000096qGIAQ
Let us know if this will help you