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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDevelopment - Load a module within my moduleDevelopment - Load a module within my module
Previous
 
Next
New Post
9/17/2012 10:11 AM
 

Hello everyone!

 I'm currently trying to load an existing module to the module I'm developing. So far I achieved something using:

 string path = "~/DesktopModules/Comentarios/View.ascx";
 PortalModuleBase module = (PortalModuleBase)this.LoadControl(pathToControl);
 module.ModuleConfiguration = ModuleConfiguration;
 module.ID = ModuleId.ToString() + "777";
 MyPlaceHolder.Controls.Add(module);

This works (kind of). I mean, the module loads successfully. However, lots of things don't work.  This is probably because all the database related stuff isn't created for the module. Is there a way to achieve this database-related stuff? Also, I'm missing the resource configuration, but that's not too bad at this point =P.

 Thanks a lot =),

Damian

 
New Post
9/18/2012 9:14 PM
 

Damian,

It looks like you are on the right track.

For getting the resources to work you could do:

module.LocalResourceFile = this.LocalResourceFile;

which would assign the resource of the module you are currently working with to the module you are trying to load. However that might not be exactly what you want to do. Say if your container module does not have the necessary string resources to service the "~/DesktopModules/Comentarios/View.ascx" module then you might want to do something like:

module.LocalResourceFile = "~/DesktopModules/Comentarios/App_LocalResources/View.ascx"; 

Assuming there is an actual file "~/DesktopModules/Comentarios/App_LocalResources/View.ascx.resx".


Now why the external module is not loading its data correctly is a little bit of an open issue. It depends on how that module actually works. One potential problem could be that you are assigning the module configuration from the container module to the external module with this statement:

module.ModuleConfiguration = ModuleConfiguration;

This means that the external module would now load all settings using the container module id. If the external module has its own configuration/settings for its internal functioning it might not be able to work with the configuration of the container module. If you tell me a little bit more about what you are trying to achieve maybe I could give more advice.

Here is how you could load an external module's configuration, but you need the module and tab ids.

ModuleController moduleController = new ModuleController();
        ModuleInfo externalModuleConfiguration = moduleController.GetModule(moduleID, tabID, ignoreCache);
        module.ModuleConfiguration = externalModuleConfiguration;


Hristo Evtimov
www.packflash.com
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDevelopment - Load a module within my moduleDevelopment - Load a module within my 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