public void Load_ControlEditor_TemplateDesignMode(System.Web.UI.Page myPage, string Page_ControlID) { Templates.MasterPageEditorMgr myMasterPageEditor = new Templates.MasterPageEditorMgr(); MasterPage_Lock_Control myMasterPage_Control = myMasterPageEditor.Get_MasterPage_Lock_Control(Page_ControlID); Modules.ModuleMgr myModuleMgr = new Modules.ModuleMgr(); Modules.Component myComponent = myModuleMgr.Get_Component(myMasterPage_Control.ComponentID); Modules.Component_Control myControl = myModuleMgr.Get_Control(myMasterPage_Control.ComponentID, Modules.Control_Type.Editor); if (myControl.Assembly_Name != null) { Assembly assembly = Assembly.Load(new AssemblyName(myControl.Assembly_Name)); Type _control_type = assembly.GetType(myControl.Class_Name); Control _control = myPage.LoadControl(_control_type, null); List <MasterPage_Lock_Control_Property> Control_Properties = myMasterPageEditor.Get_MasterPage_Lock_Control_Properties(myMasterPage_Control.Page_ControlID); // Load Exist Control foreach (MasterPage_Lock_Control_Property Control_Property in Control_Properties) { PropertyInfo _Control_Property = _control_type.GetProperty(Control_Property.Property_Name); switch (_Control_Property.PropertyType.FullName) { case "System.String": _Control_Property.SetValue(_control, Control_Property.Property_Value, null); break; case "System.Int32": _Control_Property.SetValue(_control, Convert.ToInt32(Control_Property.Property_Value), null); break; case "System.Boolean": _Control_Property.SetValue(_control, Convert.ToBoolean(Control_Property.Property_Value), null); break; default: _Control_Property.SetValue(_control, Control_Property.Property_Value, null); break; } } // Place PageControlID and EditMode PropertyInfo Page_ControlID_Property = _control_type.GetProperty("Page_ControlID"); Page_ControlID_Property.SetValue(_control, Page_ControlID, null); PropertyInfo EditMode_Property = _control_type.GetProperty("EditMode"); EditMode_Property.SetValue(_control, "TemplateDesignMode", null); // Create Editor PlaceHolder myPlaceHolder = (PlaceHolder)myPage.FindControl("PlaceHolder_Editor"); myPlaceHolder.Controls.Add(_control); } else { throw new Exception(string.Format("Invalid PageControl Editor.Design Mode ComponentID: {0}", myMasterPage_Control.ComponentID)); } }
public void Load_Toolbox_Component(RadTreeNodeEventArgs eNode) { List <Toolbox_Tool> myToolbox_Tools = Get_Toolbox_Tools(eNode.Node.Value, null); foreach (Toolbox_Tool myToolbox_Tool in myToolbox_Tools) { Modules.ModuleMgr myModuleMgr = new Nexus.Core.Modules.ModuleMgr(); Modules.Component myComponent = myModuleMgr.Get_Component(myToolbox_Tool.ComponentID); RadTreeNode node = new RadTreeNode(); node.Text = myToolbox_Tool.Tool_Name; node.Value = myToolbox_Tool.ComponentID; node.ImageUrl = myComponent.Component_Icon; node.Expanded = false; eNode.Node.Nodes.Add(node); } }