If you are saving the data of all your employees in an object then you can fetch the single employee detail as per your requirement. Please check the below sample code:
public with sharing class Sample1 {
public Employee__c emp {get;set;}
public Employee__c emp1{get;set;}
public Sample1(){
emp = new Employee__c();
emp1 = new Employee__c();
}
public PageReference Fetch() {
emp1= [select Name, age__c from Employee__c where Name=: emp.name];
return null;
}
}
The resulting page is like:
When you enter the name of a particular employee in the input field and click on Fetch Employee button then details of the employee will be displayed as below:
Hope this helps you! Mark this solution as best answer if it meets your requirement. Let me know if you need any further help! Best Regards, Deepthi
If you are saving the data of all your employees in an object then you can fetch the single employee detail as per your requirement.
Please check the below sample code:
The resulting page is like:
When you enter the name of a particular employee in the input field and click on Fetch Employee button then details of the employee will be displayed as below:
Hope this helps you!
Mark this solution as best answer if it meets your requirement. Let me know if you need any further help!
Best Regards,
Deepthi