/// <summary> /// Loads the child control to be displayed in this container. /// </summary> /// <param name="controlToLoad">The control to load.</param> private void LoadChildControl(SubControlInfo controlToLoad) { try { var childControl = (PortalModuleBase)this.LoadControl(controlToLoad.ControlPath); childControl.ModuleConfiguration = this.ModuleConfiguration; childControl.ID = Path.GetFileNameWithoutExtension(controlToLoad.ControlPath); this.SubControlPlaceholder.Controls.Add(childControl); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Raises the <see cref="Control.Init"/> event. /// </summary> /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); SubControlInfo controlToLoad = this.GetControlToLoad(); if (!controlToLoad.RequiresEditPermission || ModulePermissionController.CanEditModuleContent(this.ModuleConfiguration)) { this.LoadChildControl(controlToLoad); } else if (IsLoggedIn) { this.Response.Redirect(Globals.NavigateURL(this.TabId), true); } else { this.Response.Redirect(Dnn.Utility.GetLoginUrl(this.PortalSettings, this.Request), true); } this.GlobalNavigation.ModuleConfiguration = this.ModuleConfiguration; }
/// <summary> /// Loads the child control to be displayed in this container. /// </summary> /// <param name="controlToLoad">The control to load.</param> private void LoadChildControl(SubControlInfo controlToLoad) { try { PortalModuleBase mb = (PortalModuleBase)this.LoadControl(controlToLoad.ControlPath); mb.ModuleConfiguration = this.ModuleConfiguration; mb.ID = Path.GetFileNameWithoutExtension(controlToLoad.ControlPath); this.ControlsPlaceholder.Controls.Add(mb); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }