Sunday, September 11, 2016

Render, Rerender and RenderAs in Visualforce Page

Rendered: 

This to rendered(ie., display) particular filed or section based on boolean value.  In the controller you need to have get method to assign the value for this variable.

Eg:

<apex:inputField value="{obj.Filed_C}"  Rendered="{!val == true}"/>

controller:

public boolean val{get;set;}

method(){
val = true;
}


RederAs:

It is render a VF page as PDF or some other format 

Eg:


<apex:page controller="controllername" rederAs="pdf">




Rerender:

This is to Re-render (ie.,Reload) some fields, or sections  after some operation/change. For this you need to assign id to field, sections. 

Eg:


<apex:actionRegion >

     <apex:inputField value="{!xxxx}"  >   
                  <apex:actionSupport event="onchange" rerender="id1,id2" action="{!xxx}" >
                <apex:param name="Para" value="{!rowNum}" assignTo="{!IndexValue}" />                            
                        </apex:actionSupport>
                    </apex:inputField>   
                </apex:actionRegion>
</apex:inputFiel>

id1,id2 are the id's of field and sections

No comments:

Post a Comment