DotNetNuke Modules - Adding Actions
Monday, we took a look at the Anatomy of the View component and touched on the ModuleActions property. Today, we are going to dig into the Actions.Add() function a little deeper.
The Add() function has the following signature
public ModuleAction Add(int ID, string Title, string CmdName, string CmdArg, string Icon, string Url, bool UseActionEvent, SecurityAccessLevel Secure, bool Visible, bool NewWindow);
| Parameter | Description |
| ID | The ID is used to generate a unique ID for the action. You can have DotNetNuke generate this for you by calling GetNextActionID() for that parameter. |
| Title | This is the text that will display for the user. You should store this text in a RESX file and retrieve it with the following code:
Localization.GetString(LocalizationKey, this.LocalResourceFile) For LocalizationKey, you can used the built in keys located in DotNetNuke.Entities.Modules.Actions: public class ModuleActionType { public const string AddContent = "AddContent.Action"; public const string ClearCache = "ClearCache.Action"; public const string ContentOptions = "ContentOptions.Action"; public const string DeleteModule = "DeleteModule.Action"; public const string EditContent = "EditContent.Action"; public const string ExportModule = "ExportModule.Action"; public const string HelpText = "ModuleHelp.Text"; public const string ImportModule = "ImportModule.Action"; public const string ModuleHelp = "ModuleHelp.Action"; public const string ModuleSettings = "ModuleSettings.Action"; public const string MoveBottom = "MoveBottom.Action"; public const string MoveDown = "MoveDown.Action"; public const string MovePane = "MovePane.Action"; public const string MoveRoot = "MoveRoot.Action"; public const string MoveTop = "MoveTop.Action"; public const string MoveUp = "MoveUp.Action"; public const string OnlineHelp = "OnlineHelp.Action"; public const string PrintModule = "PrintModule.Action"; public const string SyndicateModule = "SyndicateModule.Action"; } |
| CmdName | The name of the command; again, you can either define your own, or use the same built in constants listed above. In short, this is the value of the key you use in the GetString function above. |
| CmdArg | This value is almost always blank. It is available so that you might pass in additional information to the action that will be processing the menu option. |
| Icon | The URL to the icon to display with the Action menu option, or link. |
| Url | If this menu will be processing the Edit link, just use EditUrl() here. If it is for some other key, use EditUrl(keyValueHere); This tells DotNetNuke what URL to create to load the specified component. |
| UseActionEvent | Causes the portal to raise an Action Event on the server and notify any registered event listeners. Most of the time you will make this value false. |
| Secure | What security level does the user need to be able to access this event? You can use one of the following constants from the DotNetNuke.Security namespace:
public enum SecurityAccessLevel { ControlPanel = -3, SkinObject = -2, Anonymous = -1, View = 0, Edit = 1, Admin = 2, Host = 3, } |
| Visible | Extra control over visibility. True or false. Most of the time you will make this true. |
| NewWindow | Will this pop up a new browser window? If so, make this value true. Otherwise, leave it false. Most of the time you will make this value false. |
So in the process of explaining the action menus, we’ve introduced the concept of resource files. This is something we will take a look at in the next post of this series.
Other post in DotNetNuke - Module Development
- Creating DotNetNuke Modules - May 20th, 2008
- Creating DNN Modules - The Tools - May 22nd, 2008
- DotNetNuke Modules - Foundational Concepts - May 26th, 2008
- DotNetNuke Modules - Install DNN into VS 2008 - May 27th, 2008
- DotNetNuke Modules - Creating Base Modules - May 28th, 2008
- DotNetNuke Modules - Registering Your Module - May 29th, 2008
- DotNetNuke Modules - Where Stuff Shows Up - June 3rd, 2008
- DotNetNuke Modules - Benefits of Architecture - June 4th, 2008
- DotNetNuke Modules - Anatomy of the View - June 9th, 2008
- DotNetNuke Modules - Adding Actions - June 11th, 2008
- DotNetNuke Modules - DNN Controls - Label - June 18th, 2008
- DotNetNuke - Internationalization - June 25th, 2008
- DotNetNuke Modules - Internationalization (part 2) - June 30th, 2008
- DotNetNuke Modules - Labels w/ no Help - July 9th, 2008
- DotNetNuke Modules - LinkButtons - July 14th, 2008
- DotNetNuke Modules - Collapsible Panels - July 16th, 2008
- DotNetNuke - The Data Layer - Installing CodeSmith - July 22nd, 2008
- DotNetNuke - Modules - Creating The Tables - July 24th, 2008
- DotNetNuke - Modules - Creating Stored Procs - July 29th, 2008
- DotNetNuke - Modules - Portal Specific Modules - July 31st, 2008
- DotNetNuke Modules - Data Access Layer - August 5th, 2008
- DotNetNuke Modules - Data Access Layer - August 7th, 2008
- DotNetNuke - Data Access Layer Alternative - August 12th, 2008
- DotNetNuke - Modules - Linking within the module - August 14th, 2008
- DotNetNuke - Make Your Module Searchable - August 19th, 2008
- DotNetNuke Modules - Making Content Portable - August 25th, 2008
- DotNetNuke Modules - Exceptions the DNN Way - September 2nd, 2008
- DotNetNuke Modules - PortalModuleBase - September 4th, 2008
- DotNetNuke Modules - Inter Module Communication - September 9th, 2008
- DotNetNuke Modules - Finding The Page a Module is On - September 15th, 2008
- DotNetNuke Modules - Caching - September 17th, 2008
- DotNetNuke Modules - Module Settings - September 22nd, 2008
- DotNetNuke Modules - Retrieving Settings - September 24th, 2008
- DotNetNuke Modules - Advanced Architecture - October 20th, 2008
- DotNetNuke Modules - Creating the PA - October 30th, 2008
- DotNetNuke Modules - Automating the PA - November 5th, 2008
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

