You need to sign in to do that
Don't have an account?
Dream_weaver
Can we assign "Standard controller " attribute dynamically in any VF page????
Is it possible? It would have saved a lot of effort of writing similer VF pages of different controller..
No, but you can use components to this effect. Here is a common idiom that I use:
For example, we have this massive program we're about to release (ERP, here we come!) that uses "line items" in many different places (more than eight). We use one common component that is called by each page, resulting in very minimal duplicated code. The trick is how to initialize this setup correctly; follow this starting point, you should do okay.
All Answers
No, but you can use components to this effect. Here is a common idiom that I use:
For example, we have this massive program we're about to release (ERP, here we come!) that uses "line items" in many different places (more than eight). We use one common component that is called by each page, resulting in very minimal duplicated code. The trick is how to initialize this setup correctly; follow this starting point, you should do okay.
Just to note replace this line of code in the component:
<apex:param name="standardController" required="true" description="The standard controller to use." type="ApexPages.StandardController" assignTo="{!standardContrller}"/>
with:
Peter
thanks for the idea. I have an additional question.
How can I use the setStandardController method for setting the standard controller based on the record Id ?? I mean..I have a record with id 001..... Given this prefix I know this is an Account record. How can I set the standard controller of the visualforce page to Account??