Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > CMS.CustomEventHandler View modes: 
User avatar
Member
Member
maggie.nu-gmail - 7/4/2011 2:04:03 PM
   
CMS.CustomEventHandler
Im trying to create CustomEventHandler
i followed the instructuion on http://devnet.kentico.com/docs/devguide/index.html?event_handling_overview.htm

but nothing happent when i add code to my customhandler class

 public override void OnAfterInsert(object treeNodeObj, int parentNodeId, object tree)
{
// INSERT YOUR CUSTOM AFTER-INSERT CODE
//ensure parent month
// type the document as TreeNode
TreeNode newsDoc = (TreeNode)treeNodeObj;

// handle the event only for news items
if (newsDoc.NodeClassName.ToLower() == "cms.news")
{
// get content of the inserted news item and send it by e-mail
EmailMessage email = new EmailMessage();
email.From = "maggie.nu@gmail.com";
email.Recipients = "admin@gmail.com";
email.Subject = "test";
email.Body = "test";
EmailSender.SendEmail(email);
}
}


what am i doing wrong

User avatar
Member
Member
maggie.nu-gmail - 7/5/2011 1:19:07 AM
   
RE:CMS.CustomEventHandler
Nevermind i have got the wrong recipient :-)