Reputation: 2032
I'm basically following this guide except I'm writing the code for Objects rather than documents. Here is my code:
using CMS.TreeEngine;
using CMS.SettingsProvider;
[CustomObjectEvents]
public partial class CMSModuleLoader
{
/// <summary>
/// Attribute class that ensures the loading of custom handlers
/// </summary>
private class CustomObjectEventsAttribute : CMSLoaderAttribute
{
/// <summary>
/// Called automatically when the application starts
/// </summary>
public override void Init()
{
// Assigns custom handlers to the appropriate events
ObjectEvents.GetContent.Execute += Category_Get_Content; //error is here
}
private void Category_Get_Content(object sender, DocumentEventArgs e)
{
// Add custom actions here
}
}
}
The line above is throwing a compile time error:
Error 1 Cannot convert method group 'Category_Get_Content' to non-delegate type 'CMS.SettingsProvider.SimpleObjectHandler'. Did you intend to invoke the method? C:\APPLICATIONS\DEVELOPMENT\KENTICO6\WebPartDev\wwwroot\App_Code\Blank Site\SearchByCategory.cs 22 40 C:...\wwwroot\
Any ideas?
Upvotes: 0
Views: 144
Reputation: 2032
I had to change DocumentEventArgs
to ObjectEventArgs
in the Category_Get_Content method.
Upvotes: 1