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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Newbie How-Do-I: Settings Newbie How-Do-I: Settings
Previous
 
Next
New Post
5/28/2007 9:14 AM
 

I'm creating my first DNN Module/Set of Modules, and have a question which is probably a no-brainer, but I can't seem to find an snswer for it. Perhaps I'm not searching correctly, but I'm still a bit ignorant regarding DNN (although I love it already!!!).  I am a VB/SQL developer with a background in T-SQL and VB 6.0 and earlier... I'm an old man ;)

Ok, So I'm creating a new Module called Sandbox...  and it will have (initially) two modules packaged into it.  They appear in the way that the two feedback module appear.  When you add Sandbox, you get two modules placed on the screen... One (SandboxEntry) for the general user community to add items into the Sandbox.... and one (SandboxView) for displayby the general user community, and for maintenance by admins.

Within SandboxView, the admin can supply two setting values which will be used to control the appearence/editting of entries within the Sandbox, on both SandboxEntry and SandboxView.

One Setting is named AllowSubjects.  It is stored (by SandboxViewSettings.vb) in the TabModuleSettings table, and that part, as well as the retrival of the value from SandboxViewSettings.vb, is functional.

However, when I go into SandboxView.vb, and try to retrieve the value, so that I may make the Subject textbox visible or not...  I can't seem to get the value back.  First of all, the same retrieval code which is used in the ViewSandboxSettings.vb code won't work in ViewSandbox.vb.  This, I guess, is because they inherit different base classes.  But I also tried to instantiate the object which I thought I needed... but I'm not getting any value back... just an empty string.  Here is that code:

Dim x As New DotNetNuke.Entities.Modules.ModuleSettingsBase
x.LoadSettings()
txtSubject.Visible = CType(x.TabModuleSettings("AllowSubjects"), Boolean)

OK, as I said, I'm a newbie, both in DNN and in Dot.Net....  So please go easy if I sound like a moron, ok? ;)

Thank you so much for any suggestions :)

-Clay Beatty

 
New Post
5/30/2007 11:51 AM
 

Assuming you module is inheriting from PortalModuleBase, you can access it via Settings["AllowSubjects"]  (which requires no instantiation on your part) and it'll pull it whether it was a TabModuleSetting -or- simply a ModuleSetting.  (this is in the view or edit module, such as ViewSandbox.ascx or EditSandbox.ascx).

An example from my "settings" file (which inherits from ModuleSettingsBase):

if (!IsPostBack)
{
string setting = TabModuleSettings["macu_usemasterlist"] as string;
if (setting != null)
{
chkMasterList.Checked = setting == "1" ? true : false;
}
setting = TabModuleSettings["macu_maxdailyrender"] as string;
if (setting != null)
{
radRenderLimit.SelectedValue = setting;
}

An example from my "Edit" page (which inherits from PortalModuleBase):

string masterListString = Settings["macu_usemasterlist"] as string;
bool useMasterList = masterListString != null ? masterListString == "1" ? true : false : false; 

Hope that helps?


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
5/30/2007 12:44 PM
 

Thank you. I'll take a look tonight when I get home.  I'm curious though... You mentioned that inheriting from PortalModuleBase, I could use Settings["AllowSubjects"]  to pull from either a TabModuleSetting or  a ModuleSetting.... How is the distinction made, if a given Setting exists at both levels?  Would it always take the most specific (favoring Tab over Module)?

Thank you again,

-Clay

 

 

 
New Post
5/30/2007 1:24 PM
 

I dunno what preference it takes... that's a good question though.  I think the assumption is made that you wouldn't have both a ModuleSetting["someKey"] and a TabModuleSetting["someKey"] for a specific module, but that you'd use one or the other.  Settings[""] on PortalModuleBase is merely another hashtable that is loaded up when the tab loads, so perhaps they do a check to see if the key exists before adding it to the hash, and, if so, replace the value with whatever.  That goes back to your question though, which takes preference... I think you are probably right that it would be the more specific takes precedence (Tab).


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
5/30/2007 11:49 PM
 

Yes, that worked....  Settings() with no instantiation.   Thank you much! :) 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Newbie How-Do-I: Settings Newbie How-Do-I: Settings


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