You need to sign in to do that
Don't have an account?
hramani
How do i pass the id of one vf page to another?
I have a vf page named 'TYRINPOUP' which has the below statement which onlick opens another vf named 'twovalues'.
<apex:commandButton value="Search" onclick="window.open('/apex/twovalues','','width=800,height=500');" action="{!testing}" rerender="panel"/>
i need to pass the id of the current vf (TYRINPOUP) to the other vf 'twovalues'
Pls help
What ID do you want to Pass either record ID or ? can you explain clearly?
I need to pass the record id. TYRINPOUP is a inline vf present on the record detail page and contains a button. onclick of this button it should open another vf named 'twovalues' where the record id of TYRINPOUP should be passed.
In your Apex class declare variable as
Public string recordId{get;set;}
To Get your current page record ID in declare this in your constructor,
recordID = ApexPages.CurrentPage().getparameters().get('id');
In your visualforce page add this in your command button
<apex:commandButton value="Search" onclick="window.open('/apex/twovalues?recordID','','width=800,height=500');" action="{!testing}" rerender="panel"/>
If you found this answer helpful to you... Please accept this as a Solution and give kudos by clicking on the star icon.
Thanks and Regards,
Arunkumar.R | Salesforce Certified Developer
If you use both onclick on action in a command button either one only will excute, you can use oncomplete instead of onclick..
Else,
You can pass id through in your pageReference method
public PageReference testing() {
PageReference pageref= new pagereference('/apex/twovalues?recordID');
pageref.setRedirect(true);
return pageref;
}
}
I tried this but I'm not able to pass the id , it is throwing up the below error (in bold)
List has no rows for assignment to SObject
An unexpected error has occurred. Your development organization has been notified.
below are the statement i used
CONTROLLER:
public class callout1{
public string recordid{get;set;}
public callout1 (ApexPages.StandardController controller) {
recordid = ApexPages.currentPage().getParameters().get('id');
}}
PAGE:
<apex:page showHeader="false" standardcontroller="Business_Unit__c" extensions="callout1">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:pageblockSection >
<apex:outputPanel id="panel">
<apex:commandButton value="Search" onclick="window.open('/apex/shelfnodiplay1?recordid','','width=800,height=500');" rerender="panel"/>
<br/>
</apex:outputPanel>
</apex:pageblockSection></apex:pageBlockButtons> </apex:pageBlock>
</apex:form>
</apex:page>
Pls help
Hi,
Try change command button onclick like below:-
Let me know if it doesn't work for you!
Regards,
Digamber Prasad
Please modify your command button ...
<apex:commandButton value="Search" onclick="window.open('/apex/CreateCase?{!recordid}','','width=800,height=500');" rerender="panel"/>
Hope this will works for you.. Let me know if you have any issue...!
If this works please mark this as a solutions and give kudos...