Access parent controller attribute from Visual force componentPass controller variable value to another controller classCan we use a custom Visualforce component twice on the same Visualforce page?Assigning VF component attribute to a List controller class variableHow to call a standard controller action of a VF page from a VF componentAccess passed attribute value in visualforce component constructorUnexpected Visualforce Order of Execution with component attributes on Get RequestGet the specified child relationship Name from Parent

How can medieval knights protects themselves against modern guns?

Does the "reappearing" property of the "Shadowneedle" Unbreakable Arrow function?

How was the Luftwaffe able to destroy nearly 4000 Soviet aircraft in 3 days of operation Barbarossa?

Does my workplace lack guidance or is it my lack of skills?

"the whole shabang" vs "the whole shebang"

Too many pull requests in backlog

Big equation writing in LaTeX

How to assemble PCBs when SMT machine doesn't have enough feeders?

A New Math Operation?

Is there a word/phrase that can describe playing a musical instrument in a casual way?

Memory models for assembly libraries for Turbo C

Is Fox News not classified as a news channel?

Is Chika Ofili's method for checking divisibility for 7 a "new discovery" in math?

Pointlessly recurse down the alphabet

Why should I invest so much in 401(k)?

Can Teflon thread tape be reused?

What can I do if one employer used offer letter from first company against me?

In a world where Magic steam Engines exist what would keep people from making cars

Where can I read the oldest and purest texts of Budhism

How can you weaponize a thermos?

What arguments have been made for not impeaching Trump?

If I have fewer than 6 Pokemon in my party, does each gain more EXP?

Today‘s scale factor of the universe

Good type of bike to get for commuting (thinking of road v touring)



Access parent controller attribute from Visual force component


Pass controller variable value to another controller classCan we use a custom Visualforce component twice on the same Visualforce page?Assigning VF component attribute to a List controller class variableHow to call a standard controller action of a VF page from a VF componentAccess passed attribute value in visualforce component constructorUnexpected Visualforce Order of Execution with component attributes on Get RequestGet the specified child relationship Name from Parent






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









2


















I have one Visualforce page and one Visualforce controller. I have different attributes defined in the controller of Visualforce page as shown below



 public boolean firstPanelget;set;
public boolean secondPanelget;set;
public boolean thirdPanelget;set;


I also have a separate controller for Visualforce component which is being called inside in visualforce page and i am passing certain list of object in visualforce component from visualforce page.
I have a function in the controller of Visualforce component which is being called when certain sets of operation is required.



Now i want when these operations are being called then attributes(firstPanel,secondPanel,thirdPanel) defined in the parent controller should be set in the component controller without redirecting. How can i accomplish this?










share|improve this question































    2


















    I have one Visualforce page and one Visualforce controller. I have different attributes defined in the controller of Visualforce page as shown below



     public boolean firstPanelget;set;
    public boolean secondPanelget;set;
    public boolean thirdPanelget;set;


    I also have a separate controller for Visualforce component which is being called inside in visualforce page and i am passing certain list of object in visualforce component from visualforce page.
    I have a function in the controller of Visualforce component which is being called when certain sets of operation is required.



    Now i want when these operations are being called then attributes(firstPanel,secondPanel,thirdPanel) defined in the parent controller should be set in the component controller without redirecting. How can i accomplish this?










    share|improve this question



























      2













      2









      2








      I have one Visualforce page and one Visualforce controller. I have different attributes defined in the controller of Visualforce page as shown below



       public boolean firstPanelget;set;
      public boolean secondPanelget;set;
      public boolean thirdPanelget;set;


      I also have a separate controller for Visualforce component which is being called inside in visualforce page and i am passing certain list of object in visualforce component from visualforce page.
      I have a function in the controller of Visualforce component which is being called when certain sets of operation is required.



      Now i want when these operations are being called then attributes(firstPanel,secondPanel,thirdPanel) defined in the parent controller should be set in the component controller without redirecting. How can i accomplish this?










      share|improve this question














      I have one Visualforce page and one Visualforce controller. I have different attributes defined in the controller of Visualforce page as shown below



       public boolean firstPanelget;set;
      public boolean secondPanelget;set;
      public boolean thirdPanelget;set;


      I also have a separate controller for Visualforce component which is being called inside in visualforce page and i am passing certain list of object in visualforce component from visualforce page.
      I have a function in the controller of Visualforce component which is being called when certain sets of operation is required.



      Now i want when these operations are being called then attributes(firstPanel,secondPanel,thirdPanel) defined in the parent controller should be set in the component controller without redirecting. How can i accomplish this?







      apex visualforce community visualforce-component salesforcedx-cli






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 14 at 13:08









      Muhammad Sheheryar AfsarMuhammad Sheheryar Afsar

      1771 silver badge9 bronze badges




      1771 silver badge9 bronze badges























          1 Answer
          1






          active

          oldest

          votes


















          2



















          One way is to pass a reference of the page controller into the component like this.



          The component has an attribute defined:



          <apex:component controller="ComponentController">
          <apex:attribute name="pc" type="PageController" description=""/>
          ...
          </apex>


          The page sets a value in that attribute via a controller property:



          <c:component pc="!controller" .../>


          The page controller property is this:



          public PageController controller 
          get
          return this;




          Then your component markup can reference the page controller properties via pc. For example !pc.firstPanel.






          share|improve this answer


























          • How can i set the value of firstPanel which is the attribute of pagecontroller in component controller in APEX Class?

            – Muhammad Sheheryar Afsar
            Sep 14 at 14:03











          • @Sheheri My bad I misunderstood your question. I don't have an answer to that.

            – Keith C
            Sep 14 at 14:10











          • @KeithC, found a post of yours addressing similar problem : salesforce.stackexchange.com/questions/220858/… .@Sheheri check this

            – Arabinda
            Sep 15 at 0:48











          • @Arabinda i dont have controller extensions in my solution. I only have one visualforce page and two visualforce component and 3 apex controllers for each visualforce page and visualforce controller. Visualforce components are included in Visualforce page. There are some logic performed on each visualforce component on the basis of which i need to decide, if i have to show the other visualforce component or not.To show the other component boolean variable has been declared in controller of Visualforce page but i dont have any way on how to access that from componenet controller.

            – Muhammad Sheheryar Afsar
            Sep 15 at 8:47











          • @MuhammadSheheryarAfsar, that case I can suggest you to use cookies to store some temp variables and manipulate based on your requirement. Give a try for this cookies approach. As in your case, extensions are not linked so this approach can help.

            – Arabinda
            Sep 16 at 0:12












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "459"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f278124%2faccess-parent-controller-attribute-from-visual-force-component%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown


























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2



















          One way is to pass a reference of the page controller into the component like this.



          The component has an attribute defined:



          <apex:component controller="ComponentController">
          <apex:attribute name="pc" type="PageController" description=""/>
          ...
          </apex>


          The page sets a value in that attribute via a controller property:



          <c:component pc="!controller" .../>


          The page controller property is this:



          public PageController controller 
          get
          return this;




          Then your component markup can reference the page controller properties via pc. For example !pc.firstPanel.






          share|improve this answer


























          • How can i set the value of firstPanel which is the attribute of pagecontroller in component controller in APEX Class?

            – Muhammad Sheheryar Afsar
            Sep 14 at 14:03











          • @Sheheri My bad I misunderstood your question. I don't have an answer to that.

            – Keith C
            Sep 14 at 14:10











          • @KeithC, found a post of yours addressing similar problem : salesforce.stackexchange.com/questions/220858/… .@Sheheri check this

            – Arabinda
            Sep 15 at 0:48











          • @Arabinda i dont have controller extensions in my solution. I only have one visualforce page and two visualforce component and 3 apex controllers for each visualforce page and visualforce controller. Visualforce components are included in Visualforce page. There are some logic performed on each visualforce component on the basis of which i need to decide, if i have to show the other visualforce component or not.To show the other component boolean variable has been declared in controller of Visualforce page but i dont have any way on how to access that from componenet controller.

            – Muhammad Sheheryar Afsar
            Sep 15 at 8:47











          • @MuhammadSheheryarAfsar, that case I can suggest you to use cookies to store some temp variables and manipulate based on your requirement. Give a try for this cookies approach. As in your case, extensions are not linked so this approach can help.

            – Arabinda
            Sep 16 at 0:12















          2



















          One way is to pass a reference of the page controller into the component like this.



          The component has an attribute defined:



          <apex:component controller="ComponentController">
          <apex:attribute name="pc" type="PageController" description=""/>
          ...
          </apex>


          The page sets a value in that attribute via a controller property:



          <c:component pc="!controller" .../>


          The page controller property is this:



          public PageController controller 
          get
          return this;




          Then your component markup can reference the page controller properties via pc. For example !pc.firstPanel.






          share|improve this answer


























          • How can i set the value of firstPanel which is the attribute of pagecontroller in component controller in APEX Class?

            – Muhammad Sheheryar Afsar
            Sep 14 at 14:03











          • @Sheheri My bad I misunderstood your question. I don't have an answer to that.

            – Keith C
            Sep 14 at 14:10











          • @KeithC, found a post of yours addressing similar problem : salesforce.stackexchange.com/questions/220858/… .@Sheheri check this

            – Arabinda
            Sep 15 at 0:48











          • @Arabinda i dont have controller extensions in my solution. I only have one visualforce page and two visualforce component and 3 apex controllers for each visualforce page and visualforce controller. Visualforce components are included in Visualforce page. There are some logic performed on each visualforce component on the basis of which i need to decide, if i have to show the other visualforce component or not.To show the other component boolean variable has been declared in controller of Visualforce page but i dont have any way on how to access that from componenet controller.

            – Muhammad Sheheryar Afsar
            Sep 15 at 8:47











          • @MuhammadSheheryarAfsar, that case I can suggest you to use cookies to store some temp variables and manipulate based on your requirement. Give a try for this cookies approach. As in your case, extensions are not linked so this approach can help.

            – Arabinda
            Sep 16 at 0:12













          2















          2











          2









          One way is to pass a reference of the page controller into the component like this.



          The component has an attribute defined:



          <apex:component controller="ComponentController">
          <apex:attribute name="pc" type="PageController" description=""/>
          ...
          </apex>


          The page sets a value in that attribute via a controller property:



          <c:component pc="!controller" .../>


          The page controller property is this:



          public PageController controller 
          get
          return this;




          Then your component markup can reference the page controller properties via pc. For example !pc.firstPanel.






          share|improve this answer














          One way is to pass a reference of the page controller into the component like this.



          The component has an attribute defined:



          <apex:component controller="ComponentController">
          <apex:attribute name="pc" type="PageController" description=""/>
          ...
          </apex>


          The page sets a value in that attribute via a controller property:



          <c:component pc="!controller" .../>


          The page controller property is this:



          public PageController controller 
          get
          return this;




          Then your component markup can reference the page controller properties via pc. For example !pc.firstPanel.







          share|improve this answer













          share|improve this answer




          share|improve this answer










          answered Sep 14 at 13:45









          Keith CKeith C

          111k14 gold badges111 silver badges249 bronze badges




          111k14 gold badges111 silver badges249 bronze badges















          • How can i set the value of firstPanel which is the attribute of pagecontroller in component controller in APEX Class?

            – Muhammad Sheheryar Afsar
            Sep 14 at 14:03











          • @Sheheri My bad I misunderstood your question. I don't have an answer to that.

            – Keith C
            Sep 14 at 14:10











          • @KeithC, found a post of yours addressing similar problem : salesforce.stackexchange.com/questions/220858/… .@Sheheri check this

            – Arabinda
            Sep 15 at 0:48











          • @Arabinda i dont have controller extensions in my solution. I only have one visualforce page and two visualforce component and 3 apex controllers for each visualforce page and visualforce controller. Visualforce components are included in Visualforce page. There are some logic performed on each visualforce component on the basis of which i need to decide, if i have to show the other visualforce component or not.To show the other component boolean variable has been declared in controller of Visualforce page but i dont have any way on how to access that from componenet controller.

            – Muhammad Sheheryar Afsar
            Sep 15 at 8:47











          • @MuhammadSheheryarAfsar, that case I can suggest you to use cookies to store some temp variables and manipulate based on your requirement. Give a try for this cookies approach. As in your case, extensions are not linked so this approach can help.

            – Arabinda
            Sep 16 at 0:12

















          • How can i set the value of firstPanel which is the attribute of pagecontroller in component controller in APEX Class?

            – Muhammad Sheheryar Afsar
            Sep 14 at 14:03











          • @Sheheri My bad I misunderstood your question. I don't have an answer to that.

            – Keith C
            Sep 14 at 14:10











          • @KeithC, found a post of yours addressing similar problem : salesforce.stackexchange.com/questions/220858/… .@Sheheri check this

            – Arabinda
            Sep 15 at 0:48











          • @Arabinda i dont have controller extensions in my solution. I only have one visualforce page and two visualforce component and 3 apex controllers for each visualforce page and visualforce controller. Visualforce components are included in Visualforce page. There are some logic performed on each visualforce component on the basis of which i need to decide, if i have to show the other visualforce component or not.To show the other component boolean variable has been declared in controller of Visualforce page but i dont have any way on how to access that from componenet controller.

            – Muhammad Sheheryar Afsar
            Sep 15 at 8:47











          • @MuhammadSheheryarAfsar, that case I can suggest you to use cookies to store some temp variables and manipulate based on your requirement. Give a try for this cookies approach. As in your case, extensions are not linked so this approach can help.

            – Arabinda
            Sep 16 at 0:12
















          How can i set the value of firstPanel which is the attribute of pagecontroller in component controller in APEX Class?

          – Muhammad Sheheryar Afsar
          Sep 14 at 14:03





          How can i set the value of firstPanel which is the attribute of pagecontroller in component controller in APEX Class?

          – Muhammad Sheheryar Afsar
          Sep 14 at 14:03













          @Sheheri My bad I misunderstood your question. I don't have an answer to that.

          – Keith C
          Sep 14 at 14:10





          @Sheheri My bad I misunderstood your question. I don't have an answer to that.

          – Keith C
          Sep 14 at 14:10













          @KeithC, found a post of yours addressing similar problem : salesforce.stackexchange.com/questions/220858/… .@Sheheri check this

          – Arabinda
          Sep 15 at 0:48





          @KeithC, found a post of yours addressing similar problem : salesforce.stackexchange.com/questions/220858/… .@Sheheri check this

          – Arabinda
          Sep 15 at 0:48













          @Arabinda i dont have controller extensions in my solution. I only have one visualforce page and two visualforce component and 3 apex controllers for each visualforce page and visualforce controller. Visualforce components are included in Visualforce page. There are some logic performed on each visualforce component on the basis of which i need to decide, if i have to show the other visualforce component or not.To show the other component boolean variable has been declared in controller of Visualforce page but i dont have any way on how to access that from componenet controller.

          – Muhammad Sheheryar Afsar
          Sep 15 at 8:47





          @Arabinda i dont have controller extensions in my solution. I only have one visualforce page and two visualforce component and 3 apex controllers for each visualforce page and visualforce controller. Visualforce components are included in Visualforce page. There are some logic performed on each visualforce component on the basis of which i need to decide, if i have to show the other visualforce component or not.To show the other component boolean variable has been declared in controller of Visualforce page but i dont have any way on how to access that from componenet controller.

          – Muhammad Sheheryar Afsar
          Sep 15 at 8:47













          @MuhammadSheheryarAfsar, that case I can suggest you to use cookies to store some temp variables and manipulate based on your requirement. Give a try for this cookies approach. As in your case, extensions are not linked so this approach can help.

          – Arabinda
          Sep 16 at 0:12





          @MuhammadSheheryarAfsar, that case I can suggest you to use cookies to store some temp variables and manipulate based on your requirement. Give a try for this cookies approach. As in your case, extensions are not linked so this approach can help.

          – Arabinda
          Sep 16 at 0:12


















          draft saved

          draft discarded















































          Thanks for contributing an answer to Salesforce Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f278124%2faccess-parent-controller-attribute-from-visual-force-component%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown









          Popular posts from this blog

          Tamil (spriik) Luke uk diar | Nawigatjuun

          Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

          Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?