I want to load ModuleContent of other tab modules without its container into such webcontrol like panel.it's something like what adding existing module in controlpanel do.The difference is that adding existing module ,add module with container in skin pane but i want to add only ModuleContent (without container) in panel of my own module.my written code is below but it doesn't work.please help me.
Public Sub LoadModule()
Try
Dim objPortalModuleBase As Entities.Modules.PortalModuleBase = Nothing
'get module info from PortalID:0 ,TabID:56 ,ModuleID:404
Dim objModule As ModuleInfo = ObjController.GetModuleInfo(0, 56, 404)
Dim objPanel As New Panel
objPanel.ID = "ModuleContent"
' module content visibility options
Dim blnContent As Boolean = PortalSettings.ContentVisible
If blnContent Then
' if the module supports caching and caching is enabled for the instance and the user does not have Edit rights or is currently in View mode
If objModule.DefaultCacheTime <> -1 AndAlso objModule.CacheTime <> 0 AndAlso (PortalSecurity.HasEditPermissions(objModule.ModulePermissions) = False Or PortalSettings.UserMode = PortalSettings.Mode.View) Then
' use output caching
objPortalModuleBase = New PortalModuleBase
Else
' load the control dynamically
If objModule.ControlSrc.ToLower.EndsWith(".ascx") Then
' load from a user control on the file system
objPortalModuleBase = CType(Me.LoadControl("~/" & objModule.ControlSrc), PortalModuleBase)
Else
' load from a typename in an assembly ( ie. server control )
Dim objType As System.Type = Framework.Reflection.CreateType(objModule.ControlSrc)
objPortalModuleBase = CType(Me.LoadControl(objType, Nothing), PortalModuleBase)
End If
End If
' set the control ID to the resource file name ( ie. controlname.ascx = controlname )
' this is necessary for the Localization in PageBase
objPortalModuleBase.ID = System.IO.Path.GetFileNameWithoutExtension(objModule.ControlSrc)
Else ' content placeholder
objPortalModuleBase = CType(Me.LoadControl("~/admin/Portal/NoContent.ascx"), PortalModuleBase)
End If
objPortalModuleBase.ModuleConfiguration = objModule
' module user control processing
If Not objPortalModuleBase Is Nothing Then
objPanel.Controls.Add(objPortalModuleBase)
End If
'add objPanel to my own Panel(Panel1)
Panel1.Controls.Add(objPanel)
If Not objPortalModuleBase Is Nothing Then
' force the CreateChildControls() event to fire for the PortalModuleBase ( the timing is critical for output caching )
objPortalModuleBase.FindControl("")
Dim objModuleContent As Panel = CType(objPortalModuleBase.Parent.FindControl("ModuleContent"), Panel)
If Not objModuleContent Is Nothing Then
objModuleContent.Visible = True
End If
End If
Catch ex As Exception
ProcessModuleLoadException(Me, ex)
End Try
End Sub