Exemple #1
0
        //loading user controls
        public void LoadUserControl(string keyWord, string jsonString)
        {
            //Loading the user control as slider input control
            UserControls.InputUserControl userControl = (UserControls.InputUserControl)LoadControl("~/UserControls/InputUserControl.ascx");

            //getting the data of the control from meta data service using the key word parameter
            dynamic jsonData = JsonConvert.DeserializeObject(jsonString);

            foreach (dynamic fldInfo in jsonData.FieldInfo)
            {
                if (fldInfo.FLD.ToString() == keyWord)
                {
                    userControl.FieldKeyWord = keyWord;
                }
            }
            userControl.ID = keyWord;

            //panelDependents.Controls.AddAt(0, userControl);
        }
        // *** MODIFIED QUAY 5/12/15
        //calling the function for loading Dynamic Labels
        public void CallLoadDynamicLabels(string jsonString)
        {
            dynamic jsonData = JsonConvert.DeserializeObject(jsonString);

            foreach (dynamic fldInfo in jsonData.FieldInfo)
            {
                if (fldInfo.TYP == "IP" || fldInfo.TYP == "IB")
                {
                    string keyWord = fldInfo.FLD;
                    keyWord = keyWord.ToUpper();
                    UserControls.InputUserControl userControl = null;
                    // Find user control for this keyword
                    foreach (Control Ctrl in this.Controls)
                    {
                        if (Ctrl.ClientID == "MainForm")
                        {
                            foreach (Control ChildCTRL in Ctrl.Controls)
                            {
                                if (ChildCTRL.ClientID == "PanelUserInputs")
                                {
                                    foreach (Control InputCtrl in ChildCTRL.Controls)
                                    {
                                        if (InputCtrl is UserControls.InputUserControl)
                                        {
                                            if ((InputCtrl as UserControls.InputUserControl).FieldKeyWord.ToUpper() == keyWord)
                                            {
                                                userControl = InputCtrl as UserControls.InputUserControl;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    if (userControl != null)
                    {
                        userControl.FieldUnit = fldInfo.UNT;
                    }
                }
            }
        }