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

Need Radio button on a tabular data coming from List

I am a newbie for VF and APEX, I am trying to display a list of records in  apex datatable with a radio button, the radio buttons should be initially unchecked and only one radio button can be checked by the user, I need to grab the SF Id once user clicks on the radio button for a record, I have written a wrapper class to get the radio button with the list in VF, the problem is, my VF page loads with all the radio button selected.



Code for Wrapper Class:


public class Select_Wrapper {

public Orgs__c aum {get; set;}

        public Boolean selected {get; set;}


        public Select_Wrapper(Orgs__c nc){

            aum = nc;

            selected = false;



Code For Controller :


public with sharing class abc {

public string msg{get;set;}

public string oid{get;set;}

public string compName{get;set;}

public string compDomain{get;set;}

public string ssId{get;set;}

public string Info{get;set;}

public integer updFlag = 0;

public integer recCount{get;set;}

public List<KOW> Selected_KOW;

public List<Orgs__c> InfgNCO = new List<Orgs__c>();

public List<Select_Wrapper> wrapPrd = New List<Select_Wrapper>();

    public abc(ApexPages.StandardSetController controller) {

     Selected_KOW = (List<KOW>) controller.getSelected();



    public List<Select_Wrapper> Os(){

        if(wrapPrd == null){

            wrapPrd = new List<Select_Wrapper>();




     for(Orgs__c nc : [Select Name,Co_in__c,Co__c,ss_ID__c,Info__c From Orgs__c where something...]){

     Select_Wrapper objWrap = new Select_Wrapper(nc);





        return wrapPrd;


    public Pagereference Finddata()


     return null;





VF Page:


<apex:page standardController="KOW"  recordSetVar="var2" extensions="abc">

<apex:form id="theForm">


  <apex:outputPanel id="theResultPanel">

  <apex:actionStatus startText="(Fetching Data...)" stopText=" " id="searchStatus"/>


  <apex:dataTable value="{!Os}" var="var1" cellPadding="4" border="1" width="100%">

  <apex:column >

                    <apex:selectRadio value="{!var1.selected}"/>


  <apex:column >

  <apex:facet name="header">Name</apex:facet>

  <apex:outputText value="{!var1.aum.Name}"/>


  <apex:column >

  <apex:facet name="header">Cross Link</apex:facet>

<apex:outputText value="{!var1.aum.Co_in__c}"/>


  <apex:column >

  <apex:facet name="header">Company</apex:facet>

<apex:outputText value="{!var1.aum.Co__c}"/>


  <apex:column >

  <apex:facet name="header">Addfd</apex:facet>

<apex:outputText value="{!var1.aum.ss_ID__c}"/>


  <apex:column >

  <apex:facet name="header">Information</apex:facet>

<apex:outputText value="{!var1.aum.Info__c}"/>








Best Answer chosen by Admin (Salesforce Developers) 
Have a look at this post.

All Answers

Have a look at this post.
This was selected as the best answer
Thanks a ton


Hi dax_trax,


Can you please post your working code here?


I am having same problem. Hence it would be useful.



Devendra S