public class ControllerClass {
public List<Candidate__c> Cnd {get; set;}
public List<Candidate__c> Cnd1 {get; set;}
public ControllerClass(){
Cnd = new List<Candidate__c>();
Cnd = [select First_Name__c from Candidate__c];
}
public PageReference directVal() {
Cnd1 = new List<Candidate__c>();
String str = ApexPages.currentpage().getparameters().get('getId'); //retrieved the record of the selected value and stored as a string
Cnd1=[select First_Name__c,Last_Name__c from Candidate__c where id=:str];
return null;
}
}
You can pass the values from Page to controller using the param function. Please take a look on the code below.
Hope this helps you!
Best Regards,
Deepthi