Radio Button selected by default in Visualforce page

Radio Button selected by default in Visualforce page


Below is the simple code to select Radio button by default in Visualforce page.


Visualforce:


<apex:selectRadio value=”{!searchCategory}” >
    <apex:selectOption itemValue=”Member” itemlabel=”Member”/>
    <apex:selectOption itemValue=”Blog” itemlabel=”Blog”/>
    <apex:selectOption itemValue=”Photo” itemlabel=”Photo”/>
</apex:selectRadio>

Apex:

public class search 
{
………………………………………………….

………………………………………………….
// Constructor of the class
public search()
{
searchCategory = ‘Member’;
}
………………………………………………….

……………………………………………….

}

Leave a Reply