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
Ganesh Babu 7Ganesh Babu 7 

Pass selectRadio itemvalue to Controller using Param

Below is my Code, Is there any way we can pass the  selected Item value using actionsupport Param name selectedvalue

 <apex:selectRadio value="{!isselected[s.id]}"  id="col1">
             <apex:selectOption itemValue="true" itemLabel="Yes"  />
             <apex:selectOption itemValue="false" itemLabel="No"/>
            <apex:actionsupport action="{!optyline}" event="onclick" reRender="formid" immediate="false"   >
          <apex:param value="{!s.id}" assignTo="{!id}"  name="a"/>
          <apex:param value=""  assignTo="{!isselected[id]}" name="selectedvalue"/> 
         </apex:actionsupport>
         </apex:selectRadio>

 
Akshay_DhimanAkshay_Dhiman
Hi Ganesh,
 
​Visualforce page-->

<apex:page controller="RadioButton" showheader="false">
<apex:form>
<apex:pageblock id="allcons" title="Available Contacts">
               <apex:pageblocktable id="allcons" value="{!AllContacts}" var="allcon">
                    <apex:column headervalue="Set as Primary">                    
                       <apex:actionsupport action="{!selectcon}" event="onclick" rerender="consel,allcons">  
                        <input type="radio" />                    
                            <apex:param name="conid" value="{!allcon.Id}">
                        </apex:param></apex:actionsupport>                            
                    </apex:column>    
                    <apex:column headervalue="Last Name">
                        <apex:outputfield value="{!allcon.LastName}">
                    </apex:outputfield></apex:column> 
                    <apex:column headervalue="First Name">
                        <apex:outputfield value="{!allcon.FirstName}">
                    </apex:outputfield></apex:column>  
                    <apex:column headervalue="Email">
                        <apex:outputfield value="{!allcon.Email}">
                    </apex:outputfield></apex:column>  
                    <apex:column headervalue="Phone">
                        <apex:outputfield value="{!allcon.Phone}">
                    </apex:outputfield></apex:column>  
                </apex:pageblocktable>
</apex:pageblock> 
<apex:pageblock id="consel" title="Selected Contact">
            <apex:pageblocktable id="allcons" value="{!selectedContact}" var="selcon">                       
                    <apex:column headervalue="Last Name">
                        <apex:outputfield value="{!selcon.LastName}">
                    </apex:outputfield></apex:column> 
                    <apex:column headervalue="First Name">
                        <apex:outputfield value="{!selcon.FirstName}">
                    </apex:outputfield></apex:column>  
                    <apex:column headervalue="Email">
                        <apex:outputfield value="{!selcon.Email}">
                    </apex:outputfield></apex:column>  
                    <apex:column headervalue="Phone">
                        <apex:outputfield value="{!selcon.Phone}">
                    </apex:outputfield></apex:column>  
                </apex:pageblocktable>
</apex:pageblock>               
</apex:form>
</apex:page>

Apex Controller--->

public class RadioButton {
List<contact> selectcon;
Public List<contact> getAllContacts()
{
    List<contact> allcons = [Select Id,FirstName,LastName,Email,Phone from Contact limit 5];
    return allcons;
}    
Public void selectcon()
{
    String selcontactid = System.currentPagereference().getParameters().get('conid');
    Contact con = [Select Id,FirstName,LastName,Email,Phone from Contact where Id=:selcontactid];
    selectcon =  new List<contact>();
    selectcon.add(con);
}
Public List<contact> getselectedContact()
{
    return selectcon;
}
}



if you found this answer helpful then please mark it as best answer so it can help others.

Thanks
Akshay