Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Retrieving settings from the view controlRetrieving settings from the view control
Previous
 
Next
New Post
2/6/2007 8:26 PM
 

Having successfully saved module settings in the settings.ascx module control, how do I retrieve those settings in the view control? The ModuleSettingsBase class doesn't appear to be available from the view control (probably because they both inherit from the same PortalModuleBase class. There must be a simple way to retrieve this setting from the view control though. What am I missing?

 

russ...

 
New Post
2/6/2007 9:18 PM
 
IMO, when doing a custom module, you should strive to isolate yourself from the core schema as much as possible.  This will allow your module to have clean installs and clean uninstalls.  I think its best to create your own table to store your module settings.  This will allow you to access your settings via your own controller class.  It also insulates your module from future changes to DNN.
 
New Post
2/6/2007 11:12 PM
 

PortalModuleBase from which your module controls will inherit provides the read only public property Settings which is a hashtable keyed by the setting name. An individual setting may be retrieved and cast or converted to its appropriate type as follows:

Dim PageSize As Integer = Convert.ToInt32(Me.Settings("PageSize"))
Dim EnableModeration As Boolean = Convert.ToBoolean(Me.Settings("EnableModeration"))

When I have more than a couple of module settings, I prefere to define a configuration class which loads all of the appropriate settings either in the module's Page_Load event handler or on demand and makes them available as public properties.  Also, to more easily manage type casting and provide default values in case the particular module setting key does not exist, my Utilities class defines a number of overloaded GetValue functions, one for each data type. For example, for the boolean:

Public Overloads Shared Function GetValue(ByVal setting As Object, ByVal defaultvalue As Boolean) As Boolean
    If setting Is Nothing Then
          Return defaultvalue
    Else
          Return Convert.ToBoolean(setting)
    End If
End Function

Obtaining  a module setting then becomes (in the configuration class):

Dim _EnableModeration As Boolean
_EnableModeration = Utilities.GetValue(Settings("EnableModeration"), False)

Public Property EnableModeration() As Boolean
Get
Return _EnableModeration
End Get
Set (ByVal value As Boolean)
_EnableModeration = value
End Set
End Property
 

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Retrieving settings from the view controlRetrieving settings from the view control


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out