2

I am having trouble in DotNetNuke 7 accessing module settings using

Settings["mySetting"].ToString();

from a method in a custom partial class which inherits "myModuleBase". I am using a module development template that already has a partial class defined called "view" and "edit" which inherit myModuleBase and are able to get module settings using the above.

I don't understand where the problem lies.

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
Mark Hollas
  • 1,107
  • 1
  • 16
  • 44

1 Answers1

2

I received this answer on DNN Community Exchange so I thought I would post it here in case it help someone else

courtesy of Chris Hammond, Director of Training at DotnetNuke

In order to access the settings make sure you have the ModuleConfiguration being passed over to the other class.

You can see an example of this with my Simple Article module

http://dnnsimplearticle.codeplex.com/SourceControl/changeset/view/20228#83727

var controlToLoad = "Controls/ArticleList.ascx";
if (ArticleId > 0) {
    controlToLoad = "Controls/ArticleView.ascx";
}
var mbl = (dnnsimplearticleModuleBase)LoadControl(controlToLoad);
mbl.ModuleConfiguration = ModuleConfiguration;
mbl.ID = System.IO.Path.GetFileNameWithoutExtension(controlToLoad);
phViewControl.Controls.Add(mbl);
iiminov
  • 969
  • 1
  • 15
  • 34
Mark Hollas
  • 1,107
  • 1
  • 16
  • 44