smbeaudry
smbeaudry

Reputation: 51

DNN ModuleID not being passed from the code behind to the ascx

Backstory: I use a DNN (DotNetNuke) content management system to host VB.NET/Angular1 modules.

I'm currently having an issue where a value in the code-behind is not accessible in the View.ascx of my module. This is causing a fatal runtime error.

The code behind where the value is being passed to a publicly defined variable

The View.ascx where the variable is being used

Erreur: icod est présentement indisponible. 
DotNetNuke.Services.Exceptions.ModuleLoadException: C:\inetpub\wwwroot\FRANCO-NORD-www1\DesktopModules\icod\View.ascx(2): error BC30451: 'modID' n'est pas déclaré. Il peut être inaccessible en raison de son niveau de protection. ---> System.Web.HttpCompileException: C:\inetpub\wwwroot\FRANCO-NORD-www1\DesktopModules\icod\View.ascx(2): error BC30451: 'modID' n'est pas déclaré. Il peut être inaccessible en raison de son niveau de protection.
à System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
à System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
à System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
à System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
à DotNetNuke.UI.ControlUtilities.LoadControl[T](TemplateControl containerControl, String ControlSrc)
à DotNetNuke.UI.Modules.WebFormsModuleControlFactory.CreateModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration)
à DotNetNuke.UI.Modules.ModuleControlFactory.LoadModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration)
à DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() --- Fin de la trace de la pile d'exception interne --

I noticed that they reference View.ascx(2) as if there are two physical versions of the file in the project or on the server, but this is not the case.

Any ideas on what may be going on here? Please let me know should the post require additional information.

Upvotes: 2

Views: 238

Answers (2)

smbeaudry
smbeaudry

Reputation: 51

I've resolved the issue by rebuilding my local development instance of DNN to a version higher than that of the production instance and rebuilt the module. I believe one of the DLLs we use in our environment, PetaPoco was causing an issue when the module was installed on a lower version of DNN. Previously my local copy of DNN was 9.1.0.367, it is now 9.1.1.129 whereas the production instance is at 9.1.1.113 .

It's not ideal that fixing it required a total reinstantiation of my development environment, but I believe a simple upgrade to an equal or greater version of the destination site would have fixed the issue as well.

Upvotes: 2

Fix It Scotty
Fix It Scotty

Reputation: 2852

My best guess, based on the updated screenshot, is that your full class name is incorrect in your View.ascx. It is expecting a codebehind class "Christoc.Modules.icod.View", but no namespace is defined in your partial class which means it will default to your default project namespace (which I am assuming is different).

I would try two things.

1) Ensure the namespace is defined in your View.ascx.cs

Namespace Christoc.Modules.icod
    Partial Class View
        ...
    End Class
End Namespace

2) Make sure you are building your module's assembly into the correct /bin folder of your DNN installation.

Upvotes: 0

Related Questions