I want to show page block as a popup when a button in clicked.

<apex:pageBlock><apex:commandButton value="Test Popup" /></apex:pageBlock><apex:pageBlock id="pb1"></apex:pageBlock>

1 Answer 1


Have a look at the following UI elements:

both can be used easily by either referencing a div container as content or loading an external page as an iframe. So using the div or apex:outputPanel just fill it with your pageBlock content somewhere in the page, hide it and call your dialog to display it, like (jquery example):

//don't forget to include jquery and jqueryUI as static resources

<apex:commandButton onclick="openDialog();" value="Open Dialog"/>    

<div id="dialog" style="display: none;">
    ... // your pageBlock content goes here


    function openDialog(){
       $( "#dialog" ).dialog();


There are lots of options to tweak dialogs and ExtJs has the advantage that the libraries are already available as salesforce uses them heavily.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .