You need to sign in to do that
Don't have an account?
Charles McDowell
Unknown constructor 'ProjectExtensionController.ProjectExtensionController(ApexPages.StandardController controller)'
I am new to Salesforce. I have a list of a custom object (Proje using StandardSetController. I want a button to navigate to the next page. I am getting the "Unknown constructor 'ProjectExtensionController.ProjectExtensionController(ApexPages.StandardController controller)' Thanks in advance for your help
My Extension Class
public class ProjectExtensionController {
Public ProjectExtensionController(Apexpages.StandardSetController Controller) {
}
Public PageReference EditRec(){
ID id = System.currentPageReference().getparameters().get('ProjectID');
PageReference ProjectDetail = Page.ProjectDetail;
ProjectDetail.setRedirect(True);
ProjectDetail.getParameters().get('id');
return ProjectDetail;
}
}
_____________________Markup
<apex:page standardController ="Project__c" recordSetVar="Proj" extensions="ProjectExtensionController" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable title="Project Datasheet" value="{!Proj}" var="p" >
<apex:column >
<apex:commandLink value="{!p.name}" action="{!EditRec}">
<apex:param Name="ProjectID" value="{!p.ID}" />
</apex:commandLink>
</apex:column>
<apex:column value="{!p.Account__c}" />
<apex:column value="{!p.Date__c}" />
<apex:column value="{!p.Description__c}" />
<apex:column value="{!p.Status__c}" />
<apex:column value="{!p.City__c}" />
<apex:column value="{!p.Project_Total__c}" />
</apex:pageBlockTable>
<!--{!$CurrentPage.parameters.ProjectID} -->
<apex:pageBlockButtons >
<apex:commandButton value="Cancel" action="{!Cancel}" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
My Extension Class
public class ProjectExtensionController {
Public ProjectExtensionController(Apexpages.StandardSetController Controller) {
}
Public PageReference EditRec(){
ID id = System.currentPageReference().getparameters().get('ProjectID');
PageReference ProjectDetail = Page.ProjectDetail;
ProjectDetail.setRedirect(True);
ProjectDetail.getParameters().get('id');
return ProjectDetail;
}
}
_____________________Markup
<apex:page standardController ="Project__c" recordSetVar="Proj" extensions="ProjectExtensionController" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable title="Project Datasheet" value="{!Proj}" var="p" >
<apex:column >
<apex:commandLink value="{!p.name}" action="{!EditRec}">
<apex:param Name="ProjectID" value="{!p.ID}" />
</apex:commandLink>
</apex:column>
<apex:column value="{!p.Account__c}" />
<apex:column value="{!p.Date__c}" />
<apex:column value="{!p.Description__c}" />
<apex:column value="{!p.Status__c}" />
<apex:column value="{!p.City__c}" />
<apex:column value="{!p.Project_Total__c}" />
</apex:pageBlockTable>
<!--{!$CurrentPage.parameters.ProjectID} -->
<apex:pageBlockButtons >
<apex:commandButton value="Cancel" action="{!Cancel}" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
This isn't actually a custom controller, but rather a controller extension.
If you don't need standard controller functionality (and it looks like you don't, since you're not referring to it anywhere), the correct syntax for the page tag is If you're really trying to write a controller extension, then your extension needs to have a constructor that takes an argument of ApexPages.StandardSetController. Hope this will help you with the above issue.
Kindly mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra
Kindly mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra