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.0Load UserControl (ascx)Load UserControl (ascx)
Previous
 
Next
New Post
3/13/2008 5:00 AM
 

Hi @all

I'm creating a DNN Module with three ascx-files. The first control (view) shows two LinkButtons and one panel. When I click on the first LinkButton, the second ascx-control will be loaded into the panel. The second LinkButton do the same with the third ascx-control. I load the controls with panel1.controls.add(second.ascx).
This works so far. But on my second ascx I've got two DropDownLists. The first will be filled wenn the module is loading. The second will be filled, when the selection in the first is done (autopostpack). 

My problem is: When I do the selection in the first DropDown on the second ascx, the second ascx disapears. how can I solve this?

Or is there an other way to load ascx-files within my dnn module?

Thanks
Marcel  

 
New Post
3/13/2008 8:10 AM
 


Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
3/13/2008 1:35 PM
 

I commonly develop DotNetNuke custom modules using multiple ascx pages.  I always have a "master" ascx control that is merely used to control which ascx should be loaded depending on a parameter in the querystring.  It looks something like this:

If Request.Params("go") = "sum" Then
                Dim objModule As Entities.Modules.PortalModuleBase = Nothing
                objModule = CType(LoadControl("DNNReportingPolSum.ascx"), Entities.Modules.PortalModuleBase)
                objModule.ModuleConfiguration = ModuleConfiguration
                Controls.Add(objModule)
            ElseIf Request.Params("go") = "search" Then
                Dim objModule As Entities.Modules.PortalModuleBase = Nothing
                objModule = CType(LoadControl("DNNReportingSearch.ascx"), Entities.Modules.PortalModuleBase)
                objModule.ModuleConfiguration = ModuleConfiguration
                Controls.Add(objModule)
            ElseIf Request.Params("go") = "view" Or Request.Params("go") = "act" Or Request.Params("go") = "pend" Then
                Dim objModule As Entities.Modules.PortalModuleBase = Nothing
                objModule = CType(LoadControl("DNNReportingView.ascx"), Entities.Modules.PortalModuleBase)
                objModule.ModuleConfiguration = ModuleConfiguration
                Controls.Add(objModule)
            ElseIf Request.Params("go") = "ind" Then
                Dim objModule As Entities.Modules.PortalModuleBase = Nothing
                objModule = CType(LoadControl("DNNReportingIndividual.ascx"), Entities.Modules.PortalModuleBase)
                objModule.ModuleConfiguration = ModuleConfiguration
                Controls.Add(objModule)
            ElseIf Request.Params("go") = "ws" Then
                Dim objModule As Entities.Modules.PortalModuleBase = Nothing
                objModule = CType(LoadControl("DNNReportingWorksite.ascx"), Entities.Modules.PortalModuleBase)
                objModule.ModuleConfiguration = ModuleConfiguration
                Controls.Add(objModule)
            ElseIf Request.Params("go") = "pdf" Then
                Dim objModule As Entities.Modules.PortalModuleBase = Nothing
                objModule = CType(LoadControl("DNNReportingGenerate.ascx"), Entities.Modules.PortalModuleBase)
                objModule.ModuleConfiguration = ModuleConfiguration
                Controls.Add(objModule)
            Else
                Dim objModule As Entities.Modules.PortalModuleBase = Nothing
                objModule = CType(LoadControl("DNNReportingStart.ascx"), Entities.Modules.PortalModuleBase)
                objModule.ModuleConfiguration = ModuleConfiguration
                Controls.Add(objModule)
            End If

Those 4 lines of code are all you need to load in an ascx control and you don't have to bother with asp panels to control visibility of controls

 
New Post
3/13/2008 7:08 PM
 

Sorry, want to borrow your thread as it is related:

I need to load another module into a module - kinda like DNNStuff's Aggregator module does, but I just want a very basic wrapper around a module. If the module is already on the page (ie. it's not just a .ascx file - it has Module Settings/config and is it's own entity) - how do I load up an instance of a module into another one? I literally just want a wrapper around an existing module...


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
3/14/2008 9:49 AM
 

Rodney,

As you see in the example in the post above yours, a module is nothing but a control that inherits from PortalModuleBase. So all you need to do is:

Dim objModule As Entities.Modules.PortalModuleBase = Nothing
Dim myPath as string = "<REPLACE THE PATH TO THE MODULE HERE>"
objModule = CType(LoadControl(myPath + "<MyModule.ascx>")
objModule.Settings = Me.Settings
objModule.LocalResourceFile = Me.LocalResourceFile

 


Do you know the truth when you hear it?
Néstor Sánchez
The Dúnadan Raptor -->Follow Me on Twitter Now!
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Load UserControl (ascx)Load UserControl (ascx)


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