What
is Difference in render, rerender and renderas attributes of visualforce
rendered– It works like
“display” property of CSS. Used to show or hide element.
rerender – After Ajax which
component should be refreshed – available on commandlink, commandbutton,
actionsupport etc.
renderas – render page as
pdf, doc and excel.
<apex:pageBlock rendered="{!ShowpageBlockFlag}">
Public
Boolean ShowpageBlockFlag{get;set;}
Public
myControllr (){
accRec
= [select name,id,accountnumber from account limit 1];
ShowpageBlockFlag
= false;
}
Public
void ShowBlockMethod(){
ShowpageBlockFlag
= true;
}
<apex:pageBlock
>
<apex:commandButton value="Refresh" action="{!ShowBlockMethod}" rerender="pgblckID"/>
</apex:pageBlock>
<apex:pageBlock
id="pgblckID">
<b> Output Text :
</b> <apex:outputText
value="{!OutPutString}"/>
</apex:pageBlock>
Public
with sharing class
myControllr {
Public
string OutPutString{get;set;}
Public
myControllr (){
OutPutString
= 'Test value set in Constructor';
}
Public
void ShowBlockMethod(){
OutPutString
= 'value set in methode called by button click' ;
}
}
No comments:
Post a Comment