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

Error: Unknown constructor 'MyController.MyController(ApexPages.StandardSetController controller)'
Hi,
I have a custom controller called: MyController, I did
Error: Unknown constructor 'MyController.MyController(ApexPages.StandardSetController controller)'.
On my controller code I have the following implementation of a simple constructor:
public class MyController {
public Plan_Table__c table;
public List <Table_Account__c> table_acc;
public MyController() {
table = null;
table_acc = null;
}
// some get and set APIs ....
...
...
...
}
Why do I keep getting this error when saving my tag file:
<apex:page standardStylesheets="false" sidebar="false" StandardController="Table_Account__c" Extensions="MyController" tabStyle="Account" recordSetVar="acc">
...
...
...
Thanks,
Guy
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
<apex:page standardStylesheets="false" sidebar="false" Controller= "MyController" tabStyle="Account">
If you're really trying to write a controller extention, then your extention needs to have a constructor that takes an argument of ApexPages.StandardSetController.
public ApexPages.StandardSetController stdCntrlr {get; set;}
public MyController(ApexPages.StandardSetController controller) {
All Answers
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
<apex:page standardStylesheets="false" sidebar="false" Controller= "MyController" tabStyle="Account">
If you're really trying to write a controller extention, then your extention needs to have a constructor that takes an argument of ApexPages.StandardSetController.
public ApexPages.StandardSetController stdCntrlr {get; set;}
public MyController(ApexPages.StandardSetController controller) {
Avrom
Hoping you can help with my issue. I am getting the same error message as the user above:
I thought I had done everything as you said in your posted reply, but am still getting the "unknown constructor" error message.
Here is the code to my class:
Here is my vf page tag:
In written english, what I am trying to accomplish is the following:
Since I am still getting the "unknown constructor" error, I cannot determine where I correctly identify my Property__c object as the constructor for my extension.
I have referenced this page extensively to no avail:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_pages_standardsetcontroller.htm
Hi Shawn,
I'm a bit confused...I don't see a constructor in your class at all.
A constructor looks a bit like a method, but it has no specified return type and the same name as the class. So it would look something like
I believe I've added the missing constructor. Is this correct?