DotNetNuke Modules – Retrieving Settings

ppl-wom-018 On Monday we discussed how to save setting information for our modules.  Today we want to pick back up where we left off and deal with retrieving that information, both in the LoadSettings() method and in the view module.

The Primary Method of Retrieval
The main retrieval method is the Settings property that is available in both the view and the settings module.  This is an indexed property that takes the key we specified in the Update methods as the indexer and returns the string that we saved as the value.

Behind the scenes, this property looks in the instance-specific settings and then in the global settings for the module and retrieves the data for us.  Since the property is set up as a hash table, all return values are typed as objects.  You’ll need to cast them to strings before you actually do anything with them.

Alternate Properties
You can also use the TabModuleSettings[] property and the ModuleSettings[] property to get the specific information.  The only reason I can think that you might want to do this is if you managed to make the key the same for a global setting and a module instance setting.  But that wouldn’t be very smart, and my naming convention for the keys makes that practically impossible.

Limitations …
The last bit of information you need to know about module settings is that the value can only be up to 2000 characters long.  At the risk of sounding like Bill Gates, 2000 characters ought to be enough for anyone.

But of course it isn’t always.

… and Solutions
I’ve only had one instance where I needed to store more than 2000 characters and fortunately I was reasonably sure that 4000 characters would do the trick.  So, I just split the data between two keys and stored half in one and half in the other.

The other solution, of course, is to store this information in your own table where you have control over the size and/or can delete rows as the data shrinks.

 


Other post in DotNetNuke - Module Development

Other Related Items:

Ladies Black Yoga Pants 26 Piece Stone Setting on Front WaistLadies Black Yoga Pants 26 Piece Stone Setting on Front WaistLadies Black Yoga Pants 26 Piece Stone Setting on Front Waist
Standard Deviants School NB Personal Finance Module 2: Saving StrateStandard Deviants School NB Personal Finance Module 2: Saving StrateThe Standard Deviants will teach you how to manage your finances, starting with saving strategies that will help you hold on to your money once you've earned it. Then it's on to investing, including such exciting topics as risk tolerance and investment allocation strategies.
Princeton Tec Eos Rebel Bike Light (Black with Black Lens Ring)Princeton Tec Eos Rebel Bike Light (Black with Black Lens Ring)Princeton Tec Eos Bike Maxbright Rebel LED Headlight. Eos Bike takes self-contained battery lighting to the next level. The combination of a Maxbrigh... Read More >

Related Post

Comments are closed.

DotNetNuke Sponsor

 

Most Valuable Blogger
Sponsor