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...Using Modules a...Using Modules a...CanCan't view the Settings control in custom module
Previous
 
Next
New Post
3/22/2012 7:49 PM
 

DNN Ver: 5.6.7

I added a custom module to my site, and the View control works fine, but when I'm in edit mode and I select "Settings" I just get a Critical error "Object reference not set to an instance of an object."

I've verified that I have an actual settings.ascx file on my site and it's registered/installed according to the Host -> Extensions ->Edit Module Control screen.

Key: Settings
Title: MyModule Settings
Source: points to the correct file
Type: Edit

Is there another config that I haven't set? I've compared it to other modules that are working and everything looks the same.

Thanks

 
New Post
3/22/2012 10:40 PM
 

In your code behind for settings.ascx does the settings class inherit from DotNetNuke.Entities.Modules.ModuleSettingBase or otherwise implement DotNetNuke.UI.Modules.ISettingsControl?

If this is not done, your custom settings control cannot be properly injected into the module's settings page. If you are correctly inheriting from ModuleSettingsBase I would:

1) Check the event viewer which may give more information (and in particular a line number) of the error.

2) Set a debugging break point in your control's LoadSettings method and see where it blows up with the null reference error.


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
 
New Post
3/23/2012 12:30 PM
 

Thanks William, very helpful.

I was always checking the IIS Event Log - I didn't even know there was an Event Viewer page (*cough* noob). I now have the full error message AND a solution!  I verified that my Settings.ascx.cs file inherits from ModuleSettingsBase.

Error Message:
"DotNetNuke.MyModule.Settings' is not allowed here because it does not extend class 'System.Web.UI.UserControl'."

Solution:

Both the Settings.ascx.cs AND the Settings.ascx.designer.cs file need to inherit from the ModuleSettingsBase class. This is a new one to me, but adding the inheritance to the designer.cs file did the trick.

Thanks again!


 
New Post
3/23/2012 1:05 PM
 

Although this is working, I'm still confused. I checked some of our other custom modules with working Settings.ascx controls, and their designer.cs files don't inherit from the ModuleSettingsBase.

 
New Post
3/23/2012 1:22 PM
 

Settings.ascx.designer.cs and Settings.ascx.cs should both define public partial classes of the same name (usually Settings) and must have the same namespace. Only the class defined in Settings.ascx.cs should inherit from DotNetNuke.Entities.SettingsModuleBase. In Settings.ascx the @Control directive should include an Inherits attribute with a value of the namespace qualified settings class.

I have found that sometimes Visual studio will incorrectly revert back to a base class (such as System.Web.UI.UserControl) when generating the designer file.


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...Using Modules a...Using Modules a...CanCan't view the Settings control in 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