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.0How to Get  ModuleID for the new Added user controlHow to Get ModuleID for the new Added user control
Previous
 
Next
New Post
9/16/2008 6:01 AM
 

I am using Dotnetnuke 4.08.04  and Asp.net 2.0

I added New user control ( sample.ascx )  to my module  . My class  Inherts from  Entities.Modules.PortalModuleBase.

 When I am using ModuleId it returns -1 , instead of original value . How to get module ID  for the new added user control

 

Thank to All

 
New Post
10/8/2008 3:53 AM
 

I am using Dnn 4.8.4

  I created Dynamic module , In that module I added new user control ( Dotnetnuke --> My Dynamic Module -->  Templates --> user control .ascx )

  When I am using keyword ModuleID it returns -1 , when I am using same keyword in View page ( Dotnetnuke --> My Dynamic Module --> ViewPage .ascx ) I am getting my Module ID . I copy paste same code from Viewpage to  usercontrol.ascx . but still I am not getting

I am calling my usercontrol from view Page

Please help me

My View Page Code ( Dotnetnuke --> My Dynamic Module -->  ViewPagel .ascx )

                  Dim uc_template As UserControl
                    uc_template = LoadControl("~/DesktopModules/Flash/Templates/Flash.ascx")
                    pnlTemplate.Controls.Add(uc_template)

 

My usercontrol code ( Dotnetnuke --> My Dynamic Module -->  Templates --> user control .ascx )

 Partial Class ViewFlashFile
        Inherits Entities.Modules.PortalModuleBase
        Implements Entities.Modules.IActionable

CODE..................

..........................

 

 Public ReadOnly Property ModuleActions() As Entities.Modules.Actions.ModuleActionCollection Implements Entities.Modules.IActionable.ModuleActions
            Get
                Dim Actions As New Entities.Modules.Actions.ModuleActionCollection
                Actions.Add(GetNextActionID, Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent, LocalResourceFile), Entities.Modules.Actions.ModuleActionType.AddContent, "", "", EditUrl(), False, Security.SecurityAccessLevel.Edit, True, False)
                Return Actions
            End Get
        End Property
 

 
New Post
10/9/2008 9:18 AM
 

Hi Arvind,

Loaded usercontrols don't inherit the settings and properties of the viewcontrol it's loaded into. You got to (i code in C#):

  1. create a new base class (inherited from PortalModuleBase) as the base for your childcontrol.
  2. Add a property in the, let's call it ChildBase, like ParentModule:

            public PortalModuleBase ParentModule
            {
                get { return parentModule; }
                set { parentModule = value; }
            }
  3. Load your childcontrol in the viewcontrol with:

           Flash flash = (Flash)LoadControl("~/DesktopModules/Flash/Templates/Flash.ascx";
           flash.ParentModule = this;
           pnlTemplate.Controls.Add(flash)
     
  4. Now you can use the methods of the viewcontrol in the childcontrol .
  5. If you also want to use the settings of the parent, you'll have to override the ModuleInfo in the CildBase like this:

            public new ModuleInfo ModuleConfiguration
            {
                get { return parentModule.ModuleConfiguration; }
            }

You migth even create a framework like : Base, ParentBase and ChildBase and define abstract methods and properties in the Base you can implement as needed in the ChildBase and ParentBase.


 

 

 
New Post
10/15/2008 12:00 PM
 

Thanks a lot ,

  I did as  you stated and it works  My issue got solved

 

thanks

Arvind

 
New Post
10/23/2008 7:30 PM
 

i meant off course: ModuleConfiguration and not Settings..

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to Get  ModuleID for the new Added user controlHow to Get ModuleID for the new Added user control


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