You need to sign in to do that
Don't have an account?
civic
Function call
i have the following in the class
String getsubscriptionGroupId(string conId)
String subGrpId = "hello";
return subGrpId;
how do i call the same function in my VF Page.
i need the code.
You can not call this directly like you call in apex class, this looks to me a get method
so if you will have a control like
<apex:outputLabel value="{!subscriptionGroupId}" />
this will show the value
just make sure your getsubscriptionGroupId method is public. And also remove that parameter from it. parameter is passed in set method not in get method.
I can derive many issues in it.
As you have written a get method
and want to use it on visualforce page then you need to make it look like this :
You need to make it public and you can not pass the parameter in it.
But if you want to use it in apex code itself then this will work for you like this :
When you write a getter method using on visualforce page then it will act as a property of class but you pass a parameter in it and use it in apex code it will act as a method.
Also if you are just getting the value from this property you don't need the set method. Best practice says you should not set the value in get method but there are many instance where you need to fetch the value from database and send it to visuaforce page using get and not set.
So when you use this code :
You can get the value on visualforce page like this :
Let me know if there is any other use case you want to understand.
Thanks
Ankit Arora
Blog | Facebook | Blog Page