function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gopal ChatGopal Chat 

Want to set checkbox on contact which are displayed on radion button

Here is my code
<apex:page controller="SearchRecords" showHeader="true" >
    <apex:form id="frm">
        <!----<apex:actionFunction name="showcon" action="{!showContact}" reRender="frm" /> --->
        <apex:pageblock >
            <apex:pageBlockSection title="Search Account Records" columns="1">
                Enter Name<apex:inputText value="{!getstring}" id="theTextInput"/>
                <apex:commandButton action="{!searchRecords}" value="Search" id="theSearch" reRender="frm"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Account Detail">
                <apex:pageBlocktable value="{!accountlist}" var="acc">
                    <apex:column >
                        <input type="radio" name="group1"/>
                        <apex:actionSupport event="onclick" action="{!dispalyContact}" ReRender="conpgblk" >
                            <apex:param assignTo="{!AccId}" name="accname" value="{!acc.id}"/>
                        </apex:actionSupport>
                    </apex:column>
                    <apex:column value="{!acc.Name}" />
                    <apex:column value="{!acc.Phone}" />
                </apex:pageBlocktable>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Related Contact" id="conpgblk" >
                <apex:outputPanel rendered="{!conList.size == 0}">
                    <b> NO RELATED CONTACTS FOR THIS ACCOUNT.</b>
                </apex:outputPanel>
                
                
                <apex:outputPanel rendered="{!conList.size != 0}">
                    <div align="center" draggable="false" >
                        <apex:commandButton value="Send Email" action="{!SendEmail}"/>
                        <apex:commandButton value="Print Detail" action="{!PrintDetail}"/>
                    </div>
                    <apex:pageBlockTable value="{!conList}" var="con">
                        <apex:column value="{!con.Name}"/>
                        <apex:column value="{!con.Phone}"/>
                        <apex:column value="{!con.Email}"/>
                    </apex:pageBlockTable>
                    <apex:commandButton value="First Page" rerender="conpgblk" action="{!FirstPage}" disabled="{!prev}"/>
                    <apex:commandButton value="Previous" rerender="conpgblk" action="{!previous}" disabled="{!prev}"/>
                    <apex:commandButton value="Next" rerender="conpgblk" action="{!next}" disabled=""/>
                    <apex:commandButton value="Last Page" rerender="conpgblk" action="{!LastPage}" disabled=""/>
                </apex:outputPanel>
            </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
</apex:page>

Controller
public class SearchRecords {
    private integer totalRecs = 0;
    private integer OffsetSize = 0;
    private integer LimitSize=3;
    public String AccId{get;set;}
    public string getstring{get;set;}
    public List<Account> accountlist {get;set;}
    public list<Contact> conList{get;set;}
    public void searchRecords(){
        accountlist= new list<Account>();
        if(getstring!=null){
            accountlist= Database.query('select id,AccountNumber,name,Phone from Account where name like \'%'+getstring+'%\'');
        }
    } 
    public void dispalyContact() {
        System.debug('>>>>>OffsetSize '+OffsetSize+'>>>>>'+LimitSize);
        if(AccId != null)
            conList=[SELECT id,Name,Phone,Email FROM Contact WHERE AccountId=:AccId LIMIT :LimitSize OFFSET :OffsetSize ];
        system.debug('====>'+conList);
       
    }
    public pageReference SendEmail(){
        return null;
    }
    public pageReference PrintDetail(){
        return null;
    }
    public void FirstPage()
    {
        OffsetSize = 0;
        dispalyContact();
    }
    public void previous()
    {
        OffsetSize = OffsetSize - LimitSize;
        dispalyContact();
    }
    public void next()
    {
        OffsetSize = OffsetSize + LimitSize;
        System.debug('>>>>>OffsetSize '+OffsetSize);
        dispalyContact();
    }public void LastPage()
    {
        OffsetSize = totalrecs - math.mod(totalRecs,LimitSize);
    }
    public boolean getprev()
    {
         dispalyContact();
        if(OffsetSize == 0)
            return true;
        else
            return false;
       
    }
    public boolean getnxt()
    {
        dispalyContact();
        if((OffsetSize + LimitSize) > totalRecs)
            return true;
        else
            return false;
    }
}

 
Raj VakatiRaj Vakati
Update it as shown below 
 
<apex:page controller="SearchRecords" showHeader="true" >
    <apex:form id="frm">
        <!----<apex:actionFunction name="showcon" action="{!showContact}" reRender="frm" /> --->
        <apex:pageblock >
            <apex:pageBlockSection title="Search Account Records" columns="1">
                Enter Name<apex:inputText value="{!getstring}" id="theTextInput"/>
                <apex:commandButton action="{!searchRecords}" value="Search" id="theSearch" reRender="frm"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Account Detail">
                <apex:pageBlocktable value="{!accountlist}" var="acc">
                    <apex:column >
                        <input type="checkbox" name="group1"/>
                        
                        <apex:actionSupport event="onclick" action="{!dispalyContact}" ReRender="conpgblk" >
                            <apex:param assignTo="{!AccId}" name="accname" value="{!acc.id}"/>
                        </apex:actionSupport>
                    </apex:column>
                    <apex:column value="{!acc.Name}" />
                    <apex:column value="{!acc.Phone}" />
                </apex:pageBlocktable>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Related Contact" id="conpgblk" >
                <apex:outputPanel rendered="{!conList.size == 0}">
                    <b> NO RELATED CONTACTS FOR THIS ACCOUNT.</b>
                </apex:outputPanel>
                
                
                <apex:outputPanel rendered="{!conList.size != 0}">
                    <div align="center" draggable="false" >
                        <apex:commandButton value="Send Email" action="{!SendEmail}"/>
                        <apex:commandButton value="Print Detail" action="{!PrintDetail}"/>
                    </div>
                    <apex:pageBlockTable value="{!conList}" var="con">
                        <apex:column value="{!con.Name}"/>
                        <apex:column value="{!con.Phone}"/>
                        <apex:column value="{!con.Email}"/>
                    </apex:pageBlockTable>
                    <apex:commandButton value="First Page" rerender="conpgblk" action="{!FirstPage}" disabled="{!prev}"/>
                    <apex:commandButton value="Previous" rerender="conpgblk" action="{!previous}" disabled="{!prev}"/>
                    <apex:commandButton value="Next" rerender="conpgblk" action="{!next}" disabled=""/>
                    <apex:commandButton value="Last Page" rerender="conpgblk" action="{!LastPage}" disabled=""/>
                </apex:outputPanel>
            </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
</apex:page>
 
public class SearchRecords {
    private integer totalRecs = 0;
    private integer OffsetSize = 0;
    private integer LimitSize=3;
    public String AccId{get;set;}
    public string getstring{get;set;}
    public List<Account> accountlist {get;set;}
    public list<Contact> conList{get;set;}
    public void searchRecords(){
        accountlist= new list<Account>();
        if(getstring!=null){
            accountlist= Database.query('select id,AccountNumber,name,Phone from Account where name like \'%'+getstring+'%\'');
        }
    } 
    public void dispalyContact() {
        System.debug('>>>>>OffsetSize '+OffsetSize+'>>>>>'+LimitSize);
        if(AccId != null)
            conList=[SELECT id,Name,Phone,Email FROM Contact WHERE AccountId=:AccId LIMIT :LimitSize OFFSET :OffsetSize ];
        system.debug('====>'+conList);
        
    }
    public pageReference SendEmail(){
        return null;
    }
    public pageReference PrintDetail(){
        return null;
    }
    public void FirstPage()
    {
        OffsetSize = 0;
        dispalyContact();
    }
    public void previous()
    {
        OffsetSize = OffsetSize - LimitSize;
        dispalyContact();
    }
    public void next()
    {
        OffsetSize = OffsetSize + LimitSize;
        System.debug('>>>>>OffsetSize '+OffsetSize);
        dispalyContact();
    }public void LastPage()
    {
        OffsetSize = totalrecs - math.mod(totalRecs,LimitSize);
    }
    public boolean getprev()
    {
        dispalyContact();
        if(OffsetSize == 0)
            return true;
        else
            return false;
        
    }
    public boolean getnxt()
    {
        dispalyContact();
        if((OffsetSize + LimitSize) > totalRecs)
            return true;
        else
            return false;
    }
}

 
Raj VakatiRaj Vakati
public class SearchRecords {
    private integer totalRecs = 0;
    private integer OffsetSize = 0;
    private integer LimitSize=3;
    public String AccId{get;set;}
    public string getstring{get;set;}
    public List<Account> accountlist {get;set;}
    public list<Contact> conList{get;set;}
    public   Set<Id> accIdsList ;
    
    public SearchRecords(){
        accIdsList= new Set<Id>() ;
    }
    public void searchRecords(){
        accountlist= new list<Account>();
        if(getstring!=null){
            accountlist= Database.query('select id,AccountNumber,name,Phone from Account where name like \'%'+getstring+'%\'');
        }
    } 
    public void dispalyContact() {
        System.debug('>>>>>OffsetSize '+OffsetSize+'>>>>>'+LimitSize);
        
        accIdsList.add(AccId);
        if(accIdsList != null)
            conList=[SELECT id,Name,Phone,Email FROM Contact WHERE AccountId In :accIdsList LIMIT :LimitSize OFFSET :OffsetSize ];
        system.debug('====>'+conList);
        
    }
    public pageReference SendEmail(){
        return null;
    }
    public pageReference PrintDetail(){
        return null;
    }
    public void FirstPage()
    {
        OffsetSize = 0;
        dispalyContact();
    }
    public void previous()
    {
        OffsetSize = OffsetSize - LimitSize;
        dispalyContact();
    }
    public void next()
    {
        OffsetSize = OffsetSize + LimitSize;
        System.debug('>>>>>OffsetSize '+OffsetSize);
        dispalyContact();
    }public void LastPage()
    {
        OffsetSize = totalrecs - math.mod(totalRecs,LimitSize);
    }
    public boolean getprev()
    {
        dispalyContact();
        if(OffsetSize == 0)
            return true;
        else
            return false;
        
    }
    public boolean getnxt()
    {
        dispalyContact();
        if((OffsetSize + LimitSize) > totalRecs)
            return true;
        else
            return false;
    }
}
 
<apex:page controller="SearchRecords" showHeader="true" >
    <apex:form id="frm">
        <!----<apex:actionFunction name="showcon" action="{!showContact}" reRender="frm" /> --->
        <apex:pageblock >
            <apex:pageBlockSection title="Search Account Records" columns="1">
                Enter Name<apex:inputText value="{!getstring}" id="theTextInput"/>
                <apex:commandButton action="{!searchRecords}" value="Search" id="theSearch" reRender="frm"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Account Detail">
                <apex:pageBlocktable value="{!accountlist}" var="acc">
                    <apex:column >
                        <input type="checkbox" name="group1"/>
                        
                        <apex:actionSupport event="onclick" action="{!dispalyContact}" ReRender="conpgblk" >
                            <apex:param assignTo="{!AccId}" name="accname" value="{!acc.id}"/>
                        </apex:actionSupport>
                    </apex:column>
                    <apex:column value="{!acc.Name}" />
                    <apex:column value="{!acc.Phone}" />
                </apex:pageBlocktable>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Related Contact" id="conpgblk" >
                <apex:outputPanel rendered="{!conList.size == 0}">
                    <b> NO RELATED CONTACTS FOR THIS ACCOUNT.</b>
                </apex:outputPanel>
                
                
                <apex:outputPanel rendered="{!conList.size != 0}">
                    <div align="center" draggable="false" >
                        <apex:commandButton value="Send Email" action="{!SendEmail}"/>
                        <apex:commandButton value="Print Detail" action="{!PrintDetail}"/>
                    </div>
                    <apex:pageBlockTable value="{!conList}" var="con">
                        <apex:column value="{!con.Name}"/>
                        <apex:column value="{!con.Phone}"/>
                        <apex:column value="{!con.Email}"/>
                    </apex:pageBlockTable>
                    <apex:commandButton value="First Page" rerender="conpgblk" action="{!FirstPage}" disabled="{!prev}"/>
                    <apex:commandButton value="Previous" rerender="conpgblk" action="{!previous}" disabled="{!prev}"/>
                    <apex:commandButton value="Next" rerender="conpgblk" action="{!next}" disabled=""/>
                    <apex:commandButton value="Last Page" rerender="conpgblk" action="{!LastPage}" disabled=""/>
                </apex:outputPanel>
            </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
</apex:page>

 
Gopal ChatGopal Chat
Actually I need checkbox on Contact not on Account and also by using Wrapper class