+ Start a Discussion
sweety kuttisweety kutti 

How to pass the record id to controller on click of single radio button inside apex:repeat

Navin SoniNavin Soni
HI Sweety,
// Controller
public Class PassRecordId{
public String Id{get;set;}
public List<Account> listOfAccounts{get;set;}
public List<Account> listOfSelectAccount{get;set;}
    public PassRecordId(){
        ListOfAccounts =  [SELECT Id From Account LIMIT 10000] ;
    public void AccountRecords(){
        listOfSelectAccount =  [SELECT Id From Account Where Id =: Id LIMIT 1] ;

// Page
<apex:page controller="PassRecordId" id="thePage">
    <apex:repeat value="{!listOfAccounts}" var="AccountId" id="theRepeat">
        <apex:selectRadio value="{!Id}">
            <apex:selectOptions value="{!AccountId.id}"/>
<apex:commandButton action="{!AccountRecords}" value="Get Account"/>