Re: DNN 4.x - How do I get the ModuleID in a Postback?

  •  09-20-2006, 7:17 PM

    Re: DNN 4.x - How do I get the ModuleID in a Postback?

    Protected _parentModule As DotNetNuke.Entities.Modules.PortalModuleBase
     
    _parentModule = CType(FindModuleInstance(Me), DotNetNuke.Entities.Modules.PortalModuleBase)
     
     Public Shared Function FindModuleInstance(ByVal fCtl As System.Web.UI.Control) As System.Web.UI.Control
                Dim ctl As System.Web.UI.Control = fCtl.Parent
                Dim selectedCtl As System.Web.UI.Control = Nothing
                While Not ctl Is Nothing
                    If TypeOf ctl Is DotNetNuke.Entities.Modules.PortalModuleBase Then
                        If CType(ctl, DotNetNuke.Entities.Modules.PortalModuleBase).TabModuleId = DotNetNuke.Common.Utilities.Null.NullInteger Then
                            If selectedCtl Is Nothing Then
                                selectedCtl = ctl
                            End If
                        Else
                            selectedCtl = ctl
                            Exit While
                        End If
                        Exit While
                    End If
                    ctl = ctl.Parent
                End While
                Return selectedCtl
            End Function
     
    After you get the parent module you can get the ID by _parentModule.ModuleId

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread