protected void Page_Load(object sender, EventArgs e) { try { // Get the navigation settings _nav = new CatalogNavigation(Request.QueryString); if (_nav.Edit.ToLower() == "product") { ProductEdit productEdit = (ProductEdit)LoadControl(ControlPath + "ProductEdit.ascx"); productEdit.ID = "ProductEdit"; productEdit.DataSource = _nav.ProductID; productEdit.EditComplete += editControl_EditComplete; plhControls.Controls.Add(productEdit); } else if (_nav.Edit.ToLower() == "category") { CategoryEdit categoryEdit = (CategoryEdit)LoadControl(ControlPath + "CategoryEdit.ascx"); categoryEdit.ID = "CategoryEdit"; categoryEdit.DataSource = _nav.CategoryID; categoryEdit.EditComplete += editControl_EditComplete; plhControls.Controls.Add(categoryEdit); } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
private void ShowEditControl() { panelList.Visible = false; panelEdit.Visible = true; // Inject the edit control ProductEdit productEdit = (ProductEdit)LoadControl(ControlPath + "ProductEdit.ascx"); productEdit.ModuleConfiguration = ModuleConfiguration; productEdit.StoreSettings = StoreSettings; productEdit.DataSource = _nav.ProductID; productEdit.CopyFrom = _nav.CopyProductID; productEdit.EditComplete += productEdit_EditComplete; productEdit.ID = "ProductEdit"; editControl.Controls.Add(productEdit); }