+ Start a Discussion
Suman KunduSuman Kundu 

communicating between two controllers

I have included two VF pages in a single VF page. Now both of the pages have their own controller. Now I want when a button in page1 is clicked it will call the method in controller of Page2.


Is there any way to do so? Please help me.




I think you have to simply create the instance of controler2 inside the controller1 and by using the instance of controller2 you can access the method of controller2 inside the controller1.Make sure that the controller is public.


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Suman KunduSuman Kundu

I tried it once before, but creates a diffrent instance. It works in a seperate instance, doesn't affect on the page controller instance. So no changes are actully being reflected on Page2.


Have you thought about using an extension?


You can have several extensions on one page.  You can use the same extension on multiple pages.