+ Start a Discussion
RishavRishav 

how to add a pageblock initially means onpageload but showing on some event

i want to implement a PAGEBLOCK that is hidden initially on page load but i want to show that pageblock on some event.
 Any idea then please tell me.
Best Answer chosen by Rishav
Ramesh KallooriRamesh Kalloori
Go through the below code .
<apex:page controller="test">
<apex:form >
<apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="tstpopup"/>
<apex:outputPanel id="tstpopup">
<apex:pageBlock rendered="{!displayPopup}" >
Helloo<apex:inputText value="{!txt1}"/>
</apex:pageBlock>
 </apex:outputPanel>       

   </apex:form>
</apex:page>
public class test {

    public String txt1 { get; set; }

public boolean displayPopup {get; set;}     
    
    public void closePopup() {        
        displayPopup = false;    
    }     
    public void showPopup() {        
        displayPopup = true;    
    }

}

thanks,
Ramesh

All Answers

Ramesh KallooriRamesh Kalloori
Go through the below code .
<apex:page controller="test">
<apex:form >
<apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="tstpopup"/>
<apex:outputPanel id="tstpopup">
<apex:pageBlock rendered="{!displayPopup}" >
Helloo<apex:inputText value="{!txt1}"/>
</apex:pageBlock>
 </apex:outputPanel>       

   </apex:form>
</apex:page>
public class test {

    public String txt1 { get; set; }

public boolean displayPopup {get; set;}     
    
    public void closePopup() {        
        displayPopup = false;    
    }     
    public void showPopup() {        
        displayPopup = true;    
    }

}

thanks,
Ramesh
This was selected as the best answer
RishavRishav
Hiii Ramesh,
                         Thanks for your reply,yes it's working fine.it was possible with apex only and i was trying with javascript.

Thanks 
Rishav