+ Start a Discussion
rvkrvk 

Related list link in visual force page

 i need to display   the links in visual force page  similar to the  related list links at the top of  account or any other  object standard detail page, when click on the link it should show corresponding related list exists on the same page.

Shashikant SharmaShashikant Sharma



Add a anchor tag just above the your related list

 

 

<a name="relatedListSection">&nbsp;</a>

 

Create a link and onclick of link 

 

location.href = "#relatedListSection";

 

This will solve your issue, please let me know if any issue in it.

rvkrvk

Thank you sharma for the reply. As a link i used commandLink tag  when on click it is going to related list but the  page is getting refereshed which should not happen. what  i need to do for page not to refresh. 

Shashikant SharmaShashikant Sharma

Use return false like this

 

 <script>
   function goToContactRelatedList()
   {
       location.href = "#resSection";
       return false;
   }
   </script>
   <apex:outputLink value="Contacts" onclick="return goToContactRelatedList();"> Contacts </apex:outputLink>

 It will solve your problem of page refresh

rvkrvk

Thank you. It worked.

Shashikant SharmaShashikant Sharma

Gr8 , Your welcome rvk . I would request you to mark it as Accepted Solution so that it can benifit others as well.