Northstar Research Partners

Subscribe to this Blog

 

Contact Us!

 
AppTheory wants to talk to you about your business requirements.

Click Contact to fill out an online requirements questionnaire.

Thanks!

 

DotNetNuke Blogs

 

Current Articles | Archives | Search

Get DotNetNuke Module Settings On An ASPX Page

Have you ever created a DotNetNuke module that had an ASPX page but still needed to access your module settings on said page? An example of this scenario would be if you created an ASPX page to render an XML feed, or serve up a file, etc and it needed to know some of your module's settings. This can easily be done by passing the ModuleId in the query string to the ASPX page, and then using the GetModuleSettings(int moduleId) method of the PortalSettings type. Below is an example of how one would accomplish this.

using DotNetNuke.Entities.Portals;
 
protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        int moduleId = System.Convert.ToInt32(Request.QueryString["mid"]);
        Hashtable settings = PortalSettings.GetModuleSettings(moduleId)
        string feedTitle = (string) settings["FeedTitle"];
    }
 
    catch (Exception ex)
    {
        Exceptions.ProcessModuleLoadException(this, ex);
    }
}
        

So as you can see as long as you have some way to pass in the ModuleId of the module instance you wish to access the settings of, you can use the GetModuleSettings method to load them into a Hashtable.


Posted in: DotNetNuke Tips & Tricks on Tuesday, August 19, 2008 2:25 PM by Scott Schecter

COMMENTS

KiT
# KiT
Thursday, October 30, 2008 5:56 AM
Hi,

Which DNN version are you using?
I don't seem to find GetModuleSettings method for PortalSettings type in DNN 4.08.04.
I found it in ModuleController object though.

However, it doesn't retrieve any setting when I tried using it -*-
Scott Schecter
# Scott Schecter
Wednesday, December 03, 2008 4:09 PM
4.8.1, below is the signature

public static Hashtable GetModuleSettings(int ModuleId);

Declaring Type: DotNetNuke.Entities.Portals.PortalSettings
Assembly: DotNetNuke, Version=4.8.1.0

Name (required)

Email (required)

Website

Enter the code shown above:

Privacy Statement | Terms Of Use
Copyright © 2008 AppTheory
Trend Influence TrendCRM AppTheory