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

Unable to call method to VF page / save VF
Hi Experts,
Am trying to call a method into VF, but am getting the below error

here is my class
Public class RBGeneratorController{
List<account> selectacct;
Public List<account> getAllAccounts()
{
List<account> allaccts = [Select ID,Name, Industry, Type, Billingstreet from Account limit 5];
return allaccts;
}
Public void selectacct()
{
String selaccountid = System.currentPagereference().getParameters().get('accid');
Account acc = [Select ID,Name, Industry, Type, Billingstreet from Account where Id=:selaccountid];
selectacct = new List<account>();
selectacct.add(acc);
}
//Public List<account> getselectedAccount()
//{
// return selectacct;
//}
}
here is VF page
<apex:page>
<apex:form>
<apex:pageblock id="PB" title="Available Generators">
<apex:pageblocktable id="PBT" value="{!AllAccounts}" var="allaccts">
<apex:column headervalue="Generatos">
<apex:actionsupport action="{!selectacct}" event="onclick" rerender="allcons">
<input type="radio" />
<apex:param name="accid" value="{!allcon.Id}">
</apex:param></apex:actionsupport>
</apex:column>
<apex:column headervalue="Name">
<apex:outputfield value="{!allcon.Name}">
</apex:outputfield></apex:column>
<apex:column headervalue="Industry">
<apex:outputfield value="{!allcon.Industry}">
</apex:outputfield></apex:column>
<apex:column headervalue="Type">
<apex:outputfield value="{!allcon.Type}">
</apex:outputfield></apex:column>
<apex:column headervalue="BillingStreet">
<apex:outputfield value="{!allcon.Billingstreet}">
</apex:outputfield></apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>
please help me through this
Thank you
Am trying to call a method into VF, but am getting the below error
here is my class
Public class RBGeneratorController{
List<account> selectacct;
Public List<account> getAllAccounts()
{
List<account> allaccts = [Select ID,Name, Industry, Type, Billingstreet from Account limit 5];
return allaccts;
}
Public void selectacct()
{
String selaccountid = System.currentPagereference().getParameters().get('accid');
Account acc = [Select ID,Name, Industry, Type, Billingstreet from Account where Id=:selaccountid];
selectacct = new List<account>();
selectacct.add(acc);
}
//Public List<account> getselectedAccount()
//{
// return selectacct;
//}
}
here is VF page
<apex:page>
<apex:form>
<apex:pageblock id="PB" title="Available Generators">
<apex:pageblocktable id="PBT" value="{!AllAccounts}" var="allaccts">
<apex:column headervalue="Generatos">
<apex:actionsupport action="{!selectacct}" event="onclick" rerender="allcons">
<input type="radio" />
<apex:param name="accid" value="{!allcon.Id}">
</apex:param></apex:actionsupport>
</apex:column>
<apex:column headervalue="Name">
<apex:outputfield value="{!allcon.Name}">
</apex:outputfield></apex:column>
<apex:column headervalue="Industry">
<apex:outputfield value="{!allcon.Industry}">
</apex:outputfield></apex:column>
<apex:column headervalue="Type">
<apex:outputfield value="{!allcon.Type}">
</apex:outputfield></apex:column>
<apex:column headervalue="BillingStreet">
<apex:outputfield value="{!allcon.Billingstreet}">
</apex:outputfield></apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>
please help me through this
Thank you
Please try below code :- Please mark this as solution if this will help you.
The error is because you are calling "AllAccounts" in your VFpage but the reference does not exist in the controller.
In your VF page, you have: (in Line#4)
<apex:pageblocktable id="PBT" value="{!AllAccounts}" var="allaccts">
Therefore, you'll have to add the reference onto the controller, like this:
public list<Account> AllAccounts {get; set;}
This should resolve your issue!
Thanks!