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
Aravind RAravind R 

reRender in apex pageblock is not working

I have a apex pageblock which is:

<apex:pageBlock id="kl" rendered="{!isVisible}">
</apex:pageBlock>

<apex:commandButton value="OK" action="{!submitOK}" reRender="kl"/>


In function submitOK........ I made isVisible = false;

But still the pageblock is displaying.. Please helpout in this issue...
Best Answer chosen by Aravind R
Dino_Salesforce DeveloperDino_Salesforce Developer
Hi Aravind,

If you specify rendered attribute on any elements like apex:pageBlock, apex:outputPanel, then reRender is not working properly. You need to manage ur code like:

<apex:outputPanel id='PanelId' >
<apex:pageBlock id="kl" rendered="{!isVisible}">
</apex:pageBlock>
</apex:outputPanel>

<apex:commandButton value="OK" action="{!submitOK}" reRender="PanelId"/>

If this sol is working then please mark best solution.

Thanks

All Answers

Vidhyasagaran MuralidharanVidhyasagaran Muralidharan
rendered="{If(condition)true,false}"
try this
Dino_Salesforce DeveloperDino_Salesforce Developer
Hi Aravind,

If you specify rendered attribute on any elements like apex:pageBlock, apex:outputPanel, then reRender is not working properly. You need to manage ur code like:

<apex:outputPanel id='PanelId' >
<apex:pageBlock id="kl" rendered="{!isVisible}">
</apex:pageBlock>
</apex:outputPanel>

<apex:commandButton value="OK" action="{!submitOK}" reRender="PanelId"/>

If this sol is working then please mark best solution.

Thanks
This was selected as the best answer