I want to create extension class with StandardSetController.
public with sharing class AccountExtCtrl {
private ApexPages.StandardSetController ctrl {get;set;}
public AccountExtCtrl(ApexPages.StandardSetController controller)
{
ctrl = controller;
}
//todo
}
but when i use this extension to visualforce page
<apex:page standardController="Account" extensions="AccountExtCtrl">
<!-- todo -->
</apex:page>
always print this:
common.apex.runtime.bytecode.BytecodeApexObjectType cannot be cast to
common.apex.runtime.impl.ApexType
Best Answer
You get this error because you are trying to cast a
StandardController
to aStandardSetController
. Note that you can define both constructors on one extension, in which case the extension can be used for either markup approach. Note that using aStandardSetController
allows you to use the page in aList Button
, whereas using aStandardController
allows you to use it in aDetail Button
.Works
(or)
(or)
Fails
(or)