You need to sign in to do that
Don't have an account?
Saurabh Singh 133
Hi, I want to pass an Id from VF Page to Controller by using apex:param. Following is my code please check and provide best code for it.
<apex:commandLink value="{!stu.Student_Name__c}" action="{!StudentDetailsPage}">
<apex:param name="Id" value="{!stu.Id}" assignTo="{!StuDetailId}"/>
</apex:commandLink>
Please provide code for assign this parameters value to controller page variable.
<apex:param name="Id" value="{!stu.Id}" assignTo="{!StuDetailId}"/>
</apex:commandLink>
Please provide code for assign this parameters value to controller page variable.
Greetings to you!
The apex:param tag is used to pass values from the Visualforce Page to the Apex Controller. Below is the sample code which I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
sObject used: Student__c
Visualforce:
Controller:
Or you can use below controller:
The apex:param tag is responsible for passing the Id of the Student record. The apex:param passes the value contained in {!stu.Id} and assigns it to the property back in the Apex Class - RecordToDelete. So when the Delete button is clicked first the value will be assigned to the stuDetailId via the apex:param tag and then the method - deleteStu will be executed.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
The apex:param tag is used to pass values from the Visualforce Page to the Apex Controller. Below is the sample code which I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
sObject used: Student__c
Visualforce:
Controller:
Or you can use below controller:
The apex:param tag is responsible for passing the Id of the Student record. The apex:param passes the value contained in {!stu.Id} and assigns it to the property back in the Apex Class - RecordToDelete. So when the Delete button is clicked first the value will be assigned to the stuDetailId via the apex:param tag and then the method - deleteStu will be executed.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
I understand your requirement based on the requirement i made some examplee code hope it helps you
Thanks Khan anas its works and its solved my query.
Thanks and Regards
Saurabh Singh