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
we-mpwe-mp 

VF page displayed without sidebar and header

Hi, 

 

I have a VF page that displays details for custom object. 

 

This VF page is accessed via a CommandButton, which calls a method in the Controller --

    PageReference SRPage = new PageReference('/'+customObject.id);

 

The resulting VF page is displayed in the existing window without any sidebar or header.  I would like it to display the SF sidebar and header.  How can I achieve this?

 

Thanks.

bob_buzzardbob_buzzard
Specify showHeader="true" and showSidebar="true" in your page declaration.
Message Edited by bob_buzzard on 03-08-2010 07:56 AM
we-mpwe-mp

Thanks for your response. 

Unfortunately, the page still displays without sidebar and header. 

Interestingly, I also have an OutputLink that displays the same page as I want - with sidebar and header:

 <apex: outputLink value="/{!customObject.Id}" target="_blank">

 

Is there anything else I could do?

Thank you.

bob_buzzardbob_buzzard
Wouldn't that link take you to a standard page rather than a VF page.  Are you attempting to return to a standard page from the controller also?
we-mpwe-mp

I have overridden the Standard Button & Links --> View to display the VF page.  Therefore both the commandButton and outputLink redirect to VF page.

thanks.

bob_buzzardbob_buzzard

The outputlink will open in a new window, based on the target=_blank, though I don't see why that would make such a difference.

 

I've just tried this on my dev org and it all worked as expected - I saw the sidebar and header, even when coming from a page that didn't have sidebar and header.

 

I think you'll need to post your code to progress this.

we-mpwe-mp

 

Here is the CommandButton that calls  method1()

     <apex: pageBlockButtons location="both">            
        <apex:commandButton action="{!method1}" value="PL"/>
      </apex: pageBlockButtons>  

 

 

Here is the controller code:

        PageReference method1(){

            //Populates sres Object  with data

            insert sres;
            PageReference SRPage = new PageReference('/apex/PLResultDisplay?id='+sres.id);
            return SRPage;
          }

 

 

Here is PLResultDisplay:

      apex: page standardController="sres__c" extensions="ResultController" tabstyle="sres__c"  showHeader="true" sidebar="true">
      <apex: pageMessages /> 
           <apex:sectionHeader title="Result" subtitle="View"/>

             ..........
              ......

 

 

PLResultDisplay is displayed without sidebar and headers. 

 

Thanks for you responses.

bob_buzzardbob_buzzard
Is your first commandbutton embedded into a regular VF page, or is it inside and iframe or similar?
we-mpwe-mp

It is in a simple VF page.  (Same snippet of code as before but with some additional lines)  This VF page is added to the Contact Page Layout as a new section.

<apex:page standardController="Contact" extensions="Method1Class" tabStyle="Contact" showHeader="true" sidebar="true">
<apex:pageMessages />
<apex:form title="PL Results" >
<apex:pageBlock title="PL Results" tabStyle="sres__c">
<apex:pageBlockButtons location="both">
<apex:commandButton action="{!method1}" value="PL"/>
</apex:pageBlockButtons>

 Thanks.

we-mpwe-mp

Another observation - The URL generated by

    PageReference SRPage = new PageReference('/apex/PLResultDisplay?id='+sres.id); is

https://c.na4.visual.force.com/apex/PLResultDisplay?id=a056000000FD9TmAAL&inline=1

 

If I remove the '&inline=1', the page displays with sidebar and header. 

How can I remove this this additional parameter?

 

Thank you.

PratibhPratibh
Try it by to turning off the development mode(if turned on) may that parameter is becoz of that......
TankGirlTankGirl

This is happening because you are coming from inside a Record page, i had the same issue when i was using it from a case view, but I can get around it by changing the commandbutton or commandlink to an outputlink. you may need to add action support to make sure it performs the method but let me know and i might be able to help you get it working if you are still having trouble.

 

I posted a more detailed reply at http://boards.developerforce.com/t5/General-Development/returning-a-PageReference-from-Controller-and-Salesforce-appends/m-p/209930#M47308