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 create Module SettingsHow to create Module Settings
Previous
 
Next
New Post
5/14/2007 1:22 PM
 

Is there a good tutorial on creating a Custom Modules setting?  I mean the module specific setting, which are at the bottom of a edit modules setting form?

thanks,

Dean

 
New Post
5/14/2007 2:06 PM
 

Check out adefwebservers tutorials. There is an example of making custome settings there. It's really pretty easy. Just create another control called Settings.ascx. Here is one of mine (edited), it shows getting and setting two settings from a textbox and a radiobuttonlist:

Imports DotNetNuke
Imports System.Web.UI
Imports System.io


Namespace MyCompany.Modules.ModuleName


Partial Class Settings
Inherits Entities.Modules.ModuleSettingsBase

#Region "Base Method Implementations"

Public Overrides Sub LoadSettings()
Try
If (Page.IsPostBack = False) Then 

If CType(TabModuleSettings("SettingName"), String) <> "" Then
Dim str As String = CType(TabModuleSettings("SettingName"), String)
textbox1.text = strr
End If
If CType(TabModuleSettings("SettingName2"), String) <> "" Then
radiobuttonlist.SelectedValue = CType(TabModuleSettings("SettingName2"), String)
End If
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub

Public Overrides Sub UpdateSettings()
Try
objModules.UpdateTabModuleSetting(TabModuleId, "SettingName", textbox1.text)
objModules.UpdateTabModuleSetting(TabModuleId, "SettingName2", radiobuttonlist.SelectedValue)
' refresh cache
SynchronizeModule()
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub

#End Region

End Class

End Namespace

 
New Post
5/14/2007 2:49 PM
 

Thanks for the info.

Now what is the difference between the "UpdateTabModuleSetting" and the "UpdateModuleSetting"?

I will be having multiple modules on one page incase that makes a difference.

thanks,

Dean


 
New Post
5/14/2007 4:13 PM
 

I created another Webcontrol and named it Setting.

I added a control to my module and used type: Edit. 

Now my setting control what is a label and textbox, shows up in my module text.  As if it is of type view.

Any ideas?

Dean

Here is code for Setting:

Imports DotNetNuke
Imports System.Web.UI
Imports System.io
Partial Class DesktopModules_USReportsListings_Setting
    Inherits Entities.Modules.ModuleSettingsBase
    Public Overrides Sub LoadSettings()
        Try
            If (Page.IsPostBack = False) Then

                If CType(ModuleSettings("ListingType"), String) <> "" Then
                    txtListingType.Text = CType(ModuleSettings("ListingType"), String)
                Else
                    txtListingType.Text = "CHEM"
                End If
            End If
        Catch exc As Exception 'Module failed to load
            ProcessModuleLoadException(Me, exc)
        End Try
    End Sub

    Public Overrides Sub UpdateSettings()
        Try
            Dim objModules As New DotNetNuke.Entities.Modules.ModuleController
            txtListingType.Text = txtListingType.Text.ToUpper & ""
            If txtListingType.Text <> "FEED" And txtListingType.Text <> "FERT" And txtListingType.Text <> "CHEM" And txtListingType.Text <> "CORP" Then
                txtListingType.Text = "CHEM"
            End If
            objModules.UpdateModuleSetting(ModuleId, "ListingType", txtListingType.Text)
            ' refresh cache
            SynchronizeModule()
        Catch exc As Exception 'Module failed to load
            ProcessModuleLoadException(Me, exc)
        End Try
    End Sub
End Class

 

 
New Post
5/14/2007 9:09 PM
 

By "shows up in my module text" I assume that you mean it shows up in the module's action menu. Here are several tips:

1. The normal convention is to name the settings control "Settings.ascx" and it's codefile "Settings.ascx.vb" rather than "Setting" (without the 's').  Although the control can be given different names, what is critical is . . .

2. That the control be given a key of "Settings" in the module definition.  This allows it to be found and appended at the end of the core provided module settings page.

3. Although you can use a control type of "Edit", I generally use "Admin".  This seems to be the usual convention in most modules. However, I have seen "Edit" used in some.  The control type is what governs its visibility to users in various roles. With a type of "Edit" it would be visible to anyone with Edit privileges. With type of "Admin" it is visible only to those in the Administrators role (including the superuser account "host" (usually).

4. To answer your other question concerning the difference between ModuleSettings and TabModuleSettings: The first is keyed on the ModuleID while the second is keyed on TabModuleId. Each instance of a module is given a unique TabModuleId, even if it is a copy of another module and even if it is added to the page using "Add Existing Module" rather than "Add New Module". Let's say that you first add your custom module to the portal using "Add New Module". It will be assigned both a ModuleId and a TabModuleId. Next, you add a "copy" of this module using "Add Existing Module". This second module will have the same ModuleId as the first, but a different TabModuleId.  So, TabModuleSettings, which are most often used for display preferences, apply separately to each instance of a module, even if it is a copy while ModuleSettings are somewhat more global in nature applying to the original instance of the module in the portal AND any copies of that module. The DNN core does not provide a standard way of defining settings that would apply across all instances of a module instance regardless of the way in which it was added to the page.

If, after changing the module definition to reflect a control type of "Settings" for your settings control, you are still having problems, please post your Settings.ascx markup.

 


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
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to create Module SettingsHow to create Module 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