You need to sign in to do that
Don't have an account?
kjpeterson
Can you set the tabStyle at runtime?
I want to set the tabstyle everytime a page is requested. Is there any way to achieve this? I tried this but I got an error that {!TabStyle} is an invalid tabstyle.
<apex:page sidebar="false" controller="customController" tabStyle="{!TabStyle}" >
there are two things going on when you set tab style on the apex : page component
one is the body class="leadTab" CSS specifier.
this you could probably fool around with and set using javascript.
However the other thing that occurs is the correct Tab is marked with the following style
<td class="currentTab primaryPalette" nowrap="nowrap"> <div> <a title="Leads Tab - Selected" href="/00Q/o">Leads</a> </div> </td>
This cuases it to highlight the correct tab, setting this dynamicaly using javascript is very hard and basically hacking the DOM, not a supported method or interface.
So, you cannot set tabStyle at runtime.
To do what you describe , simply create a single Visualforce Component , and then have multiple Visualforce pages which all specify their own tabStyle, and include this component as their sole contents.
now you have a seperate tabStyle on each, but they leverage common content from the component.
You might be interested in this idea:
https://success.salesforce.com/ideaView?id=08730000000BrG5AAK