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.0How to save a custom value to a custom module?How to save a custom value to a custom module?
Previous
 
Next
New Post
11/19/2008 11:57 AM
 

I'm starting to build my own custom module and I'm stuck on how to do this.  When I edit my module, I'd like to save a value to it.  When regular users view my module my module will pull that value and adjust its appearance.

Does anyone know of a tutorial that does what I am looking for?

 
New Post
11/19/2008 12:44 PM
 

Brett, there are a number of ways you can do this. Do you want to store it as a module setting, or in your own custom database table?


Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
11/19/2008 1:21 PM
 

Chris, I would like to save it as a module setting.

 
New Post
11/19/2008 10:44 PM
 

You can use the following code to store data in the module settings tabel:

Dim objMC As New Entities.Modules.ModuleController
objMC.UpdateTabModuleSetting(TabModuleId,
"YOUR_KEY_NAME_GOES_HERE", YOUR_VALUE_AS_STRING_GOES_HERE)

To get the data back you can use:

Settings("YOUR_KEY_NAME_GOES_HERE"))

This works in a module code behind, not in you app_code.  You'll need to get the module settings from the controller in the app code if that's where you need the data.

Be sure to check for null values and empty strings, as the settings won't be set until you have saved something for the first time.
DotNetNuke has a provided this very cool method for setting storage.  There is a table called TabModuleSettings that stores key/value pairs like above.  You can store just about anything there using the above code, but the value is limited to around 2000 characters.  Mind you this is not the best place to store tons of data, because the values aren't indexed and you will fill up the table which every module on every page must use.  Hoever, it is a convenient place to store data with out creating any kind of data provider.

You can check out the module template for Visual Studio and itwill have a settings control where you can see how it is typically done.  Another option is to look at http://www.snowcovered.com/Snowcovered2/Default.aspx?tabid=242&PackageID=7332 which is a free module I wrote that has the source and models the save/get features.


Eric Shafer
Houston Web Designer
Click and Create

281-206-2631
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to save a custom value to a custom module?How to save a custom value to a custom module?


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