You need to sign in to do that
Don't have an account?

passing values from VF page template to component controller..?
VF Page component class Not getting value of soID.query works if i pass hard coded ID.Please someone tell me where i am wrong..**The constructor gets called first, before any variables are set. I dont know how to do this...
public with sharing class saleslinecntlr { public string soID{get;set;} List<Sales_Order_Line__c> saOrderLin; public saleslinecntlr () { System.debug('---------'+soID); saOrderLin=[Select id,name,Product__r.Name,Serial_Number__c,Quantity__c,Sale_Price__c,Total__c from Sales_Order_Line__c where salesorderid=:**soID** order by name]; } public List<Sales_Order_Line__c> getsaOrderLin() { return saOrderLin; } }
As the constructor is first to be called during page load. And you are aware and mentioned we defines variables on top of the page and then rest of the components therefore You can write your logic in methods i.e. getter/setter to perform any logic based on the variables.
Instead of doing any logic in Constructor, you can go ahead and create getter method and write your query in it.
All Answers
soId = System.currentPageReference().getParameters().get('id');
When going to the VF page, you'd do something like this:
/apex/SalesLineVF?id=a0000000001234
As the constructor is first to be called during page load. And you are aware and mentioned we defines variables on top of the page and then rest of the components therefore You can write your logic in methods i.e. getter/setter to perform any logic based on the variables.
Instead of doing any logic in Constructor, you can go ahead and create getter method and write your query in it.