コード例 #1
0
        /// <summary>
        /// 获取Form传值
        /// </summary>
        /// <param name="fieldItem"></param>
        /// <returns></returns>
        public static String GetWebFormValue(SettingEntity fieldItem, BaseModule bpm)
        {
            String WebFormValue = String.Empty;

            //创建控件的Name和ID
            ControlHelper ControlItem = new ControlHelper(bpm.ModuleId);
            String        ControlName = ControlItem.ViewControlName(fieldItem);
            String        ControlID   = ControlItem.ViewControlID(fieldItem);

            if (fieldItem.ControlType == EnumControlType.CheckBox.ToString())
            {
                WebFormValue = WebHelper.GetStringParam(HttpContext.Current.Request, ControlName, "");
                WebFormValue = !String.IsNullOrEmpty(WebFormValue) && WebFormValue == "on" ? "true" : "false";
            }
            else if (fieldItem.ControlType == EnumControlType.FileUpload.ToString())
            {
                HttpPostedFile hpFile = HttpContext.Current.Request.Files[ControlName];
                if (hpFile != null && hpFile.ContentLength > 0)
                {
                    WebFormValue = String.Format("Url://{0}", FileSystemUtils.UploadFile(hpFile, bpm));                                                            //存放到目录中,并返回
                }
            }
            else if (fieldItem.ControlType == EnumControlType.Urls.ToString())
            {
                String ClientName = GetRichUrlsName(fieldItem);
                if (bpm.HttpContext.Items.Contains(ClientName))
                {
                    WebFormValue = Convert.ToString(bpm.HttpContext.Items[ClientName]);
                }
            }
            else if (fieldItem.ControlType == EnumControlType.Images.ToString())
            {
                String ClientName = GetMultiImagesName(fieldItem);
                if (bpm.HttpContext.Items.Contains(ClientName))
                {
                    WebFormValue = Convert.ToString(bpm.HttpContext.Items[ClientName]);
                }
            }
            else if (fieldItem.ControlType == EnumControlType.ListTree_Categorys.ToString())
            {
                String ClientName = String.Format("ListTree{0}", fieldItem.Name);
                if (bpm.HttpContext.Items.Contains(ClientName))
                {
                    WebFormValue = Convert.ToString(bpm.HttpContext.Items[ClientName]);
                }
            }
            else if (fieldItem.ControlType == EnumControlType.Label.ToString())
            {
                WebFormValue = fieldItem.DefaultValue;
            }
            else
            {
                WebFormValue = WebHelper.GetStringParam(HttpContext.Current.Request, ControlName, "");
            }
            return(WebFormValue);
        }
コード例 #2
0
        protected void RepeaterOptions_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                SettingEntity ThemeSetting = e.Item.DataItem as SettingEntity;

                KeyValueEntity KeyValue = ItemSettings.Find(r1 => r1.Key == ThemeSetting.Name);
                if (KeyValue != null && !String.IsNullOrEmpty(KeyValue.Key))
                {
                    ThemeSetting.DefaultValue = KeyValue.Value.ToString();
                }

                //构造输入控件
                PlaceHolder ThemePH = e.Item.FindControl("ThemePH") as PlaceHolder;

                #region "创建控件"
                ControlHelper ctl = new ControlHelper(this);

                ThemePH.Controls.Add((Control)ctl.ViewControl(ThemeSetting));
                #endregion

                Literal liTitle = e.Item.FindControl("liTitle") as Literal;
                liTitle.Text = String.Format("<label class=\"col-sm-3 control-label\" for=\"{1}\">{0}:</label>", !String.IsNullOrEmpty(ThemeSetting.Alias) ? ThemeSetting.Alias : ThemeSetting.Name, ctl.ViewControlID(ThemeSetting));

                if (!String.IsNullOrEmpty(ThemeSetting.Description))
                {
                    Literal liHelp = e.Item.FindControl("liHelp") as Literal;
                    liHelp.Text = String.Format("<span class=\"help-block\"><i class=\"fa fa-info-circle\"></i> {0}</span>", ThemeSetting.Description);
                }
            }
        }
コード例 #3
0
        protected void RepeaterOptions_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                SettingEntity ThemeSetting = e.Item.DataItem as SettingEntity;

                String SettingKey = String.Format("{0}.{1}", ExtendConfig.Name, ThemeSetting.Name);
                ThemeSetting.DefaultValue = Settings[SettingKey] != null?Convert.ToString(Settings[SettingKey]) : ThemeSetting.DefaultValue;



                //构造输入控件
                PlaceHolder ThemePH = e.Item.FindControl("ThemePH") as PlaceHolder;

                #region "创建控件"
                ControlHelper ctl = new ControlHelper(this);
                ctl.IconPath = "Extends";

                ThemePH.Controls.Add((Control)ctl.ViewControl(ThemeSetting));
                #endregion

                Literal liTitle = e.Item.FindControl("liTitle") as Literal;
                liTitle.Text = String.Format("<label class=\"col-sm-3 control-label\" for=\"{1}\">{0}:</label>", ViewLanguage(ThemeSetting.Name, !String.IsNullOrEmpty(ThemeSetting.Alias) ? ThemeSetting.Alias : ThemeSetting.Name), ctl.ViewControlID(ThemeSetting));


                String Description = ViewLanguage(ThemeSetting.Name, ThemeSetting.Description, "Help");
                if (!String.IsNullOrEmpty(Description))
                {
                    Literal liHelp = e.Item.FindControl("liHelp") as Literal;
                    liHelp.Text = String.Format("<span class=\"help-block\"><i class=\"fa fa-info-circle\"></i> {0}</span>", Description);
                }
            }
        }