Example #1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            this.DeleteButton.Visible = true;
            this.UpdateButton.Visible = false;

            try
            {
                int.TryParse(Request.Params["mID"], out this._moduleID);
                if (_moduleID > 0)
                {
                    module = RecyclerDB.GetModuleSettingsForIndividualModule(_moduleID);
                    if (RecyclerDB.ModuleIsInRecycler(_moduleID))
                    {
                        if (!Page.IsPostBack)
                        {
                            LoadPageDropDown();
                        }

                        // create an instance of the module
                        PortalModuleControl myPortalModule =
                            (PortalModuleControl)LoadControl(Path.ApplicationRoot + "/" + this.module.DesktopSrc);
                        myPortalModule.PortalID            = this.PortalSettings.PortalID;
                        myPortalModule.ModuleConfiguration = module;
                        selecteditem.InnerHtml             = "Selected Module : " + module.ModuleTitle;
                        // add the module to the placeholder
                        PrintPlaceHolder.Controls.Add(myPortalModule);
                    }
                    else
                    //they're trying to view a module that isn't in the recycler - maybe a manual manipulation of the url...?
                    {
                        pnlMain.Visible  = false;
                        pnlError.Visible = true;
                    }
                }
                int.TryParse(Request.Params["pID"], out _pageID);
                if (_pageID > 0)
                {
                    if (!Page.IsPostBack)
                    {
                        LoadPageDropDown();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            deleteButton.Visible = true;
            updateButton.Visible = false;

            try
            {
                _moduleID = int.Parse(Request.Params["mID"]);

                module = RecyclerDB.GetModuleSettingsForIndividualModule(_moduleID);
                if (RecyclerDB.ModuleIsInRecycler(_moduleID))
                {
                    if (!Page.IsPostBack)
                    {
                        //load tab names for the dropdown list, then bind them
                        // TODO check if this works
                        //portalTabs = new PagesDB().GetPagesFlat(portalSettings.PortalID);
                        portalTabs = new PagesDB().GetPagesFlatTable(portalSettings.PortalID);

                        ddTabs.DataBind();

                        //on initial load, disable the restore button until they make a selection
                        restoreButton.Enabled = false;
                        ddTabs.Items.Insert(0, "--Choose a Tab to Restore this Module--");
                    }

                    // create an instance of the module
                    PortalModuleControl myPortalModule =
                        (PortalModuleControl)LoadControl(Path.ApplicationRoot + "/" + module.DesktopSrc);
                    myPortalModule.PortalID            = portalSettings.PortalID;
                    myPortalModule.ModuleConfiguration = module;

                    // add the module to the placeholder
                    PrintPlaceHolder.Controls.Add(myPortalModule);
                }
                else
                //they're trying to view a module that isn't in the recycler - maybe a manual manipulation of the url...?
                {
                    pnlMain.Visible  = false;
                    pnlError.Visible = true;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }