+ Start a Discussion
Dave SullivanDave Sullivan 

Passing information to controller from VF page

I may be going about this the wrong way entirely, but I've built a custom controller to report on campaigns.  I'd like to use this same controller with multiple vf pages that will be rendered as a dashboard component where the only change is what campaign is being reported on.  However, I can't seem to figure out how to hardcode the campaign id into the VF page source and pass it up to the controller to use in its queries.  Does anyone have a suggestion on how to do this?  Very much appreciated.

prageethprageeth

Hello Dave;

1) You can create a custom component and use the "assignTo" attribute to assign the Id value to the controller(Easy).

2) You can use the "XmlStreamReader" class and read the VF page to find the hardcoded id.

Pradeep_NavatarPradeep_Navatar

You can use <apex:param> tag in visual force and provide attribute to pass information from Visual force page to controller class.'Assignto' and value attribute in <apex:param assignto="{!passvalue}" value="{!passedinformation}"> tag you can write here.

 

Hope this helps.