Example #1
0
        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));
            }
        }
Example #2
0
        public void Load_ControlPanel(System.Web.UI.Page myPage, PlaceHolder myPlaceHolder, string ControlID)
        {
            Modules.ModuleMgr myModuleMgr = new Modules.ModuleMgr();

            Modules.Component_Control myControl = myModuleMgr.Get_Control(ControlID);

            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);

                // Create Control
                //PlaceHolder myPlaceHolder = (PlaceHolder)myPage.FindControl(PlaceHolder_ID);
                myPlaceHolder.Controls.Add(_control);
            }
        }
Example #3
0
        public void Load_ControlPanel(System.Web.UI.Page myPage, string PlaceHolder_ID, string ControlID, e2Data[] MyProperties)
        {
            Modules.ModuleMgr myModuleMgr = new Modules.ModuleMgr();

            Modules.Component_Control myControl = myModuleMgr.Get_Control(ControlID);

            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);

                // Load Exist Control
                foreach (e2Data myProperty in MyProperties)
                {
                    PropertyInfo _Control_Property = _control_type.GetProperty(myProperty.FieldName);

                    switch (_Control_Property.PropertyType.FullName)
                    {
                    case "System.String":
                        _Control_Property.SetValue(_control, myProperty.FieldValue, null);
                        break;

                    case "System.Int32":
                        _Control_Property.SetValue(_control, Convert.ToInt32(myProperty.FieldValue), null);
                        break;

                    case "System.Boolean":
                        _Control_Property.SetValue(_control, Convert.ToBoolean(myProperty.FieldValue), null);
                        break;

                    default:
                        _Control_Property.SetValue(_control, myProperty.FieldValue, null);
                        break;
                    }
                }

                // Create Control
                PlaceHolder myPlaceHolder = (PlaceHolder)myPage.FindControl(PlaceHolder_ID);
                myPlaceHolder.Controls.Add(_control);
            }
        }