function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Deepika Gupta 26Deepika Gupta 26 

Visualforce Link Issue

How can i create a link on one VF page that will navigate to another VF Page.I am able to that but its opening in new tab i want it on parent window just like popup.could anyone suggest how to solve this?
DeepthiDeepthi (Salesforce Developers) 
Hi Deepika,

If you require a modal popup to be displayed when you click on a command link then please check the below sample code:
<apex:page controller="ModalController">
    <apex:form >
        <apex:pageBlock >
           <apex:pageBlockTable value="{!leads}" var="led">
           <apex:column headerValue="Name">
           <apex:commandLink value="{!led.Name}" action="{!showpopup}" >
           <apex:param name="window" value="{!}"/>
        <apex:outputPanel id="tstpopup">
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
            <apex:outputField value="{!}"/>&nbsp;&nbsp;
             <apex:outputField value="{!ll.Email}"/>&nbsp;&nbsp;
               <apex:outputField value="{!}"/>
               <apex:outputField value="{!ll.Phone}"/>
                <apex:commandButton value="cancel" action="{!closePopup}" rerender="tstpopup"/>
    <style type="text/css">
            background-color: white;
            border-width: 2px;
            border-style: solid;
            z-index: 9999;
            left: 50%;
            position: absolute;
            opacity: 0.20;
            filter: alpha(opacity = 20);
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 9998;

public with sharing class ModalController {

    public lead ll { get; set; }
    public Boolean displayPopUp { get; set; }
    public List<Lead> leads { get; set; }
    public ModalController(){
       leads=new List<Lead>();  
       ll=new lead();
       leads=[select Name,Email from Lead];

    public PageReference closePopup() {
        return null;
    public PageReference showPopup() {
    string ids=apexpages.currentpage().getparameters().get('window');
    ll =[select Name,Email,company,phone from lead  where id=:ids];
        return null;


Hope this helps you!
Best Regards,