I had to publish this bit of information, on how to get the Url of the settings page for a DotNetNuke module. Though it may be simple or even common knowledge to many, I could not find it quickly by Googling or Binging (that’s a post all of its own) it. So I decided I would post it just in case someone else was looking for it.
It turns out, it is very easy to generate the Url needed to navigate to the settings page of any given module. In this example I have used an Asp Hyperlink control on a module and set it’s ID to SettingsLink. Then in the code behind I use this code to set the NavigateUrl property to the Url of the settings page:
Me.SettingsLink.NavigateUrl = NavigateURL("Module", "ModuleId", Me.ModuleId.ToString)
You could also do this inline on the module control if you like, which would look something like this:
<a href='<%= NavigateURL("Module", "ModuleId", Me.ModuleId.ToString) %>'>Settings</a>
Using the DotNetNuke.Common.Globals.NavigateURL method makes it very simple to get the Url needed to direct a user to the settings page. The overload used takes the ControlKey parameter set to “Module” and a ParamArray. The trick is to pass in the string “ModuleId” and the actual id of the module to the ParamArray. This will return a Url similar to this one: http://localhost/SomePage/tabid/153/ctl/Module/ModuleId/558/Default.aspx
This Url will direct the user to the settings page just as if they had clicked on the Settings option from the module’s configuration menu. Which may lead some of you to wonder why you would need to do this in the first place. In my case, the module I am developing requires particular settings to be configured before the module can be enabled. There for on the initial load of the module I check to see if the user has access to configure the module and if so display a message explain that they need to configure the module before use. Included in this explanation is a link to the settings page, simply to improve the ease of use of the module.
Hopefully, this post will help someone out there looking for this information that does not appear to be published currently.
Thanks! Worked perfectly.