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 ExtensionsModulesModulesDynamically loading modules - containers are wrong?Dynamically loading modules - containers are wrong?
Previous
 
Next
New Post
7/14/2010 5:08 PM
 
I am trying to dynamically load a pane from a different tab into the contents of a module. The code I have gathered seems to work, except that the container isn't right (it is using the module title for the wrapping module, not the specified one in the pane). It is as if for the container, SkinObject.ModuleControl is set to the wrong value. What am I missing and does this work for anyone else?

I have posted the full source to this control here: http://gist.github.com/476055

To use it I instantiate it and add it to the control tree for my module:

public override void OnInit(EventArgs e) {
    Controls.Add(new DynamicPane { Pane="ContentPane", TabId=83, ModuleId=ModuleId });
    base.OnInit(e);
}
 
New Post
7/14/2010 8:39 PM
 
Hi Bill,

It's far too late for me to try to get my head around what will happen to DNN if you add panes to modules (surely it should be the other way round?), but one thing worth pointing out is that you should call base.OnInit before your code. As you currently have it you're referencing yourself (i.e. the underlying UserControl) before you've initialised yourself.

Regards,
Rhys

www.rmjcs.com - Mostly SQL Server Stuff
 
New Post
7/15/2010 9:54 AM
 
That doesn't matter.  No matter where I put the call to base, the dynamically loaded modules are still shown with the container of the wrapper module. All module actions are those of the wrapper and the title is from the wrapper (but the container control that is used is correct).

In a user control, all that OnInit does is call Page_Init if it exists, and then FrameworkInitialize if it hasn't been called already. As the control gets added to the control tree, the lifecycle gets caught up. Having the base call in the beginning or end makes no difference because FrameworkInitialize is already called and Page_Init doesn't exist (in fact I can omit it and the result is the same, still it is good practice to call the base when you override a method).

 
New Post
7/19/2010 10:37 AM
 
Figured it out: http://gist.github.com/476055

Using InjectModule in OnInit causes Container.ProcessChildControls to be run in the surrounding module's container after it is run on the injected modules. By using it in OnLoad instead, the child controls are not yet a part of the control tree when Container.ProcessChildControls executes.

The proper fix would be to check if a control is a Container in Container.ProcessChildControls and use the inner container's method if that is the case, but I don't care enough to go and report a bug in the DNN tracker or to provide a patch containing the fix. Until then, feel free to use the linked code for all your module wrapping needs.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDynamically loading modules - containers are wrong?Dynamically loading modules - containers are wrong?


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