How to send parameters to visualforce component?

Here is best way I could experience:

<apex:component controller=”c_controller”>

<apex:attribute name=”varTEst” description=”Some parameter the controller expects.”

type=”CustomObject__c” required=”false” assignTo=”{!relatedProperty}”/>



In apex class:

public class c_controller


public CustomObject__c relatedProperty {get; set;}



Now depends on how you call the component, you can even dynamically invoke the component:

CustomObject__c i = new CustomObject__c();

Component.c.ComponentName comp = new Component.c.ComponentName(relatedProperty = i);

Need more help?

Hi there, was your problem or query resolved? If not & need more assistance, please do reach out to us at, we'll be more than delighted to help. Nanostuffs has 7+ years of extensive Salesforce & iOS/Android experience.
Holler Box