Tag Archives: Visualforce Page

How to open a new Tab using PageReference in apex class?

We can use apex:commandLink to redirect a visualforce page in a new Tab URL using PageReference in apex class.

Sample Code:

VF Page:

<apex:page controller="SampleleRedirect">
	<apex:form >
		<apex:pageblock >
			<apex:commandlink action="{!redirect}" target="_blank">
				<apex:commandButton value="Open in New Tab"/>

Apex Controller:

public class SampleleRedirect {   

	public SampleleRedirect() {

	public pageReference redirect() {
		PageReference pageRef = new PageReference('http://www.biswajeetsamal.com');
		return pageRef;

Related list Button Edit/Delete/View is not working in VF Page on Service Cloud Console

If showHeader="false" in VF Page, the related list Button Edit/Delete/View won’t work on Service Cloud Console.
When showHeader is set to false, some important JS files needed for the service cloud console to function properly will not be loaded, and hence you may see some issues. It is recommended to leave showHeader as true while using in the service cloud console.

Difference between rendered, renderAs and reRender in Visualforce Page

Rendered : It’s a Boolean value and the default value is always true, It works like “display” property of CSS. It is used to place condition for a component(field, outputpanel, section etc), that will show or not on page. (If it is true, it displays the block else it will be hidden).

For Example:
Visualforce Page:
In the controller we need to have get method to assign the value for this variable.

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


public boolean val {get;set;}

val = true;

Rerender: After Ajax which component should be refreshed. For this we need to assign id to field, sections or a block. It’s available on commandlink, commandbutton, actionSupport etc.

For Example:
Visualforce Page:

    <apex:inputField value="{!TestValue}" >   
        <apex:actionSupport event="onchange" rerender="Id1,Id2,Id3,Id4" action="{!TestMethod}" >
            <apex:param name="Para" value="{!rowNum}" assignTo="{!IndexValue}" />

Here in actionSupport rerender attribute Id1,Id2,Id3,Id4 are the id’s of field and sections.

RenderAs: It is used for visualforce page show as pdf, excel or any other standard document format.

For Example:
Visualforce Page:

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

Difference between action function and action support

Action Function: Invoke the controller method from java script using AJAX and we can use action function from different places on visual force page.

Action Support: Invoke the controller method using AJAX when event occurs on page like onMouseOver, onClick, etc. and we can use action support for particular single apex component.