c# - DotNetNuke ModuleAction server-side processing -


in dnn possible add moduleaction menu item. according this article on dnn site possible additional processing on server-side. after converting code c#, actionhandler never called.

this code:

public moduleactioncollection moduleactions {         {         moduleactioncollection actions = new moduleactioncollection();         moduleaction urleventaction = new moduleaction(modulecontext.getnextactionid());         urleventaction.title = "action event example";         urleventaction.commandname = "redirect";         urleventaction.commandargument = "cancel";         urleventaction.url = "http://dotnetnuke.com";         urleventaction.useactionevent = true;         urleventaction.secure = dotnetnuke.security.securityaccesslevel.admin;         actions.add(urleventaction);         return actions;     } }  private void myactions_click(object sender, dotnetnuke.entities.modules.actions.actioneventargs e) {     dotnetnuke.ui.skins.skin.addmodulemessage(this, string.format(localization.getstring("clickmessage", localresourcefile), e.action.commandname), modulemessage.modulemessagetype.blueinfo);      switch (e.action.commandname.toupper())     {         case "redirect":             if (e.action.commandargument.toupper() != "cancel")             {                 response.redirect(e.action.url);             }             else             {                 dotnetnuke.ui.skins.skin.addmodulemessage(this, "canceled redirect", modulemessage.modulemessagetype.yellowwarning);             }             break;     } } 

and in page init attach event handler:

addactionhandler(new actioneventhandler(myactions_click)); 

i tried attaching in page load done dnn source itself. menu item shown , redirect http://dotnetnuke.com executed. breakpoint in myactions_click never hit.

what doing wrong?

i'm running in dotnetnuke 7.1 module reference dnn 6.2.

my solution ipostbackeventhandler instead of dnn way (until corrects me):

public moduleactioncollection moduleactions {         {         moduleactioncollection actions = new moduleactioncollection();         actions.add(modulecontext.getnextactionid(),                     "bla",                     "",                     "",                     "",                     "javascript:" + page.clientscript.getpostbackeventreference(this, "argument"),                     page.clientscript.getpostbackeventreference(this, "argument"),                     false,                     dotnetnuke.security.securityaccesslevel.edit,                     true,                     false);         return actions;     } }  public void raisepostbackevent(string eventargument) {     if (eventargument.toupper() == "argument")     {         ...          globals.redirect(httpcontext.current.request.rawurl, false);     } } 

and don't forget add ipostbackeventhandler page class name.

namespace: using system.web.ui;


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -