Monday, 18 March 2013

Hiding header and Sidebar in Salesforce

some times we need to hide header and sidebar of a visualforce page or standard layout.
we can do it by writing showheader = "false"  and sidebar = "false" in the visualforce page.

for example 
<apex:page controller = "TestController"  showheader = "false" sidebar = "false">
   // your information 

How can we hide in header and sidebar standard layout ?
ans- Salesforce is user friendly language, There is also a feature available so called "Enable Collapsible Section", By using this we can only hide sidebar
you can go in this way Name-->set up-->customize--> user interface--> checked the check box "
Enable Collapsible Section", after that you can show or hide sidebar.

If someone wants to hide both sidebar and header of standard layout, then how will we do it? 
Ans- It is very simple, just append "isdtp = vw" at end of link in the URL, you will see the magic.

Also you can write this in apex code.for example

PageReference samepage= new PageReference('/apex/pagename?recordid&isdtp=vw);
For testing you can write "isdtp = vw" in the any standard layout, It will automatically hide header and sidebar, Try It