You need to sign in to do that
Don't have an account?

Pass text clicked to controller method - How do I make a repeated list of clickable Id's?
This should be simple, but I can't figure it out.
I have a repeated list of record ID's, and I want to link them all to the respective record, the same way a list view links the Name field to the record.
<apex:pageBlock> <apex:panelgroup > <apex:pageblocktable value="{!sRecords}" var="r" > <apex:column > <apex:commandLink value="{!r.Id}" action="{!linkToRecord}">//How do I pass r.Id to the controller method? </apex:commandLink> </apex:column> </apex:pageblocktable> </apex:panelgroup> </apex:pageBlock>
public PageReference linkToRecord() { String recordId='001A000000P4ZYy';//How do I make this a variable based on the Id clicked? PageReference recordPage= new PageReference('/'+recordId); return recordPage; }
Hi,
I dont suppose you need a method in controller for it. Try this:
All Answers
Hi,
I dont suppose you need a method in controller for it. Try this:
You have to use apex param tag and setter getter for assignTo variable.
-
-Suresh
Thanks both! I'd love to mark both as the solution, as I used a hybrid.
SSR2-I'll use this method for another link I've been struggling with.
For this one, I'll use: