DNN2: Adding Actions to an existing DotNetNuke module's Options Menu in 12 steps

Looking for DNN4 stuff??? Check my more recent posts:
   *
DNN4.02: Create Your DotNetNuke Development Environment
   * DNN4.02: Quick & Dirty C# and VB Custom Modules
   * DNN4.02: Starting New DotNetNuke Modules in C# or VB.Net


Adding options to your module's flyout can be a little tricky. The following list uses code in C#, and applies to any existing module projects in VS 2003.

If you have yet to create your module, you may want to read DNN: Create a custom DotNetNuke Module in a dozen steps! first.

1. Add new User Control to existing module project
2. Update control to inherit from DotNetNuke.PortalModuleControl
3. Update Namespace to [company].DNN.Modules.[modulename]
4. Add using statement for DotNetNuke
5. Save and compile new empty control
6. Manually add Module definition for each new control to the Module Definitions for the module
   Type is used for security, Key is used to programatically reference a control
7. Add Menu option(s) by adding Action(s) at end of initial ("View") page's Page_Init
   base.Actions.Add(base.GetNextActionID(), "My Module Options", "", "", "", base.get_EditURL("","","Options") , "",false, SecurityAccessLevel.Edit, true, false);
8. Update .dnn file to include control section, and add file element(s)
   Options
  
   MyOptionsPage.ascx
   Edit
9. Design Additional pages
   Set CSS for text controls to DNN styles:
   Linkbuttons: CommandButton
   Validators: NormalRed
   Form Prompts: SubHead
   Text: Normal
10. Include a cancel linkbutton to return back to :
   try{Response.Redirect(get_NavigateURL(""),true);}
   catch(Exception ex){DotNetNuke.Exceptions.ProcessModuleLoadException(this, ex));}
11. Test through DNN until you're ready to package.
12. Create module package
   Identify all items needed in module, make sure they're included in .dnn file under
   Zip up all items and upload package in File Manager

Next I'll cover a much easier topic: Storing and Retrieving data for Module Settings.

!!!NOTE REGARDING DNN 3 BREAKING EditURL():
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=715571
"Change Name: EditUrl Logged by: smcculloch (Scott McCulloch) Area of Impact: Custom Modules Impacted DNN Versions: All currently released versions Who is Impacted: Third Party Module Developers Short Description: Added function overloads to EditUrl (formerly a property) Full Description: Most custom modules use the EditUrl property of the PortalModuleControl for linking off to other controls in the module. Properties with optional arguments are not very well supported by C#. So the property has now moved to a function with a number of overloads. Workaround or Recommended Course of Action: There should be no code changes required, just a recompile for binary compatibility (change from a property to a method). "

!!!NOTE REGARDING DNN 3 BREAKING NavigateURL()
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=715567
Change Name: NavigateUrl Logged by: smcculloch (Scott McCulloch) Area of Impact: Custom Modules Impacted DNN Versions: All currently released versions Who is Impacted: Third Party Module Developers Short Description: Full Description: Most custom modules use the NavigateUrl property of the PortalModuleControl for linking off to other controls in the module. Properties with optional arguments are not very well supported by C#. So the property has now moved to a function with a number of overloads. There should be no code changes required, just a recompile for binary compatibility (change from a property to a method). The method has also been moved to the Globals class, so other items such as Skin Objects, and other sections of code in DotNetNuke have access to this functionality. Workaround or Recommended Course of Action: No workaround. It will be important to use NavigateUrl or EditUrl, as it will do the rewriting of the Friendly Url path (if enabled). There will also be a FriendlyUrl method to do a rewrite if you wish to create your own urls. NavigateUrl has a param array on one of the overloads, so you should be able to add any number of parameters as well.

Print | posted on Thursday, October 14, 2004 3:52 PM

Feedback

No comments posted yet.
Title  
Name
Email (never displayed)
Url
Comments   
Please add 8 and 6 and type the answer here: