[SalesForce] How to make the links in related list which is placed within visualforce page in standard layout section redirect to the destination page separately

I have created a visualforce page which contains a related list and i have placed the visualforce page in the standard layout as a section and the problem i have here is, when i click on the create new button or view, edit etc links the navigation happens within the visualforce section but i want it to function like it does in the normal related list section (which is to redirect the user to that page).

<apex:page standardController="Contact">
  <apex:relatedList list="Sub_Contact__r" />
</apex:page>

Using the below mentioned line in the visualforce page does the trick partially.When i click on the view record link it opens in the same window, but when i click on the edit or delete link the record opens in the same window but once after i save or cancel the edited record it takes me to the visualforce page where i get to see only the related record section without even header or sidebar.

<base target="_parent"/>

Best Answer

Please add base tag with target="_parent" to open the links in the same window instead in the vf section

<apex:page standardController="Contact">
    <base target="_parent"/>
  <apex:relatedList list="Sub_Contact__r" />
</apex:page>
Related Topic