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); } } }
/// <Description> /// 分组绑定事件 /// </Description> protected void RepeaterGroup_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Repeater RepeaterOptions = e.Item.FindControl("RepeaterOptions") as Repeater; KeyValueEntity GroupItem = e.Item.DataItem as KeyValueEntity; int OptionCount = 0; BindOptionsToPage(RepeaterOptions, GroupItem.Key, out OptionCount); if (OptionCount == 0) { e.Item.Visible = false; } } }
/// <Description> /// 拼接数据项的设置参数 /// </Description> /// <returns></returns> public String SetItemSettings() { //获取效果参数 List <SettingEntity> ItemSettingDB = Setting_ItemSettingDB; List <KeyValueEntity> list = new List <KeyValueEntity>(); if (ItemSettingDB != null && ItemSettingDB.Count > 0) { ControlHelper ControlItem = new ControlHelper(ModuleId); foreach (SettingEntity ri in ItemSettingDB) { KeyValueEntity item = new KeyValueEntity(); item.Key = ri.Name; item.Value = ControlHelper.GetWebFormValue(ri, this); list.Add(item); } } return(ConvertTo.Serialize <List <KeyValueEntity> >(list)); }
/// <summary> /// 绑定数据 /// </summary> private void BindDataToPage() { EffectDB XmlDB = Setting_EffectDB; if (!(XmlDB != null && String.IsNullOrEmpty(XmlDB.Name))) { lblEffectName.Text = XmlDB.Name; lblEffectDescription.Text = XmlDB.Description; //绑定效果的主题 String EffectDirPath = String.Format("{0}Effects/{1}/Themes/", Server.MapPath(ModulePath), XmlDB.Name); DirectoryInfo EffectDir = new DirectoryInfo(EffectDirPath); if (!EffectDir.Exists) { EffectDir.Create(); } DirectoryInfo[] ThemeDirs = EffectDir.GetDirectories(); List <KeyValueEntity> dirs = new List <KeyValueEntity>(); if (ThemeDirs != null && ThemeDirs.Length > 0) { foreach (DirectoryInfo dir in ThemeDirs) { KeyValueEntity dirEntity = new KeyValueEntity(); dirEntity.Key = dir.Name; FileInfo imgFile = new FileInfo(MapPath(String.Format("{0}Effects/{1}/Themes/{2}/image.jpg", ModulePath, XmlDB.Name, dir.Name))); if (imgFile.Exists) { dirEntity.Value = String.Format("{0}Effects/{1}/Themes/{2}/image.jpg", ModulePath, XmlDB.Name, dir.Name); } else { dirEntity.Value = String.Format("http://www.dnngo.net/DesktopModules/DNNGo_PowerForms/Effects/{0}/Themes/{1}/image.jpg", XmlDB.Name, dir.Name); } dirs.Add(dirEntity); } WebHelper.BindList <KeyValueEntity>(ddlThemeName, dirs, "Key", "Value"); } WebHelper.SelectedListByText(ddlThemeName, Settings_EffectThemeName); // hfThemeThumbnails.Value = String.Format("{0}Effects/{1}/Themes/[EffectThemeName]/image.jpg", ModulePath, XmlDB.Name); if (!String.IsNullOrEmpty(Settings_EffectThemeName)) { imgThemeThumbnails.Attributes.Add("onError", String.Format("this.src='{0}Resource/images/no_image.png'", ModulePath)); imgThemeThumbnails.ToolTip = Settings_EffectThemeName; KeyValueEntity dirEntity = dirs.Find(r1 => r1.Key.IndexOf(Settings_EffectThemeName, StringComparison.CurrentCultureIgnoreCase) >= 0); imgThemeThumbnails.ImageUrl = dirEntity != null?dirEntity.Value.ToString() : ""; imgThemeThumbnails.Visible = true; } } ////获取效果参数 //List<SettingEntity> EffectSettingDB = Setting_SkinEffectSettingDB; //if (EffectSettingDB != null && EffectSettingDB.Count > 0) //{ // //绑定参数项 // RepeaterTheme.DataSource = EffectSettingDB; // RepeaterTheme.DataBind(); //} }