private void LoadSetttings(string fileName) { // due to legacy, some user controls may not have the tilde start if (fileName.StartsWith("~/")) { fileName = fileName.Substring(2); } if (System.IO.File.Exists(IOHelper.MapPath("~/" + fileName))) { UserControl oControl = (UserControl)this.Page.LoadControl(@"~/" + fileName); Type type = oControl.GetType(); Dictionary <string, DataEditorSetting> settings = GetSettings(type); foreach (KeyValuePair <string, DataEditorSetting> kv in settings) { DataEditorSettingType dst = kv.Value.GetDataEditorSettingType(); dtSettings.Add(kv.Key, dst); DataEditorPropertyPanel panel = new DataEditorPropertyPanel(); panel.Text = kv.Value.GetName(); panel.Text += "<br/><small>" + kv.Value.description + "</small>"; if (HasSettings(type)) { DataEditorSettingsStorage ss = new DataEditorSettingsStorage(); List <Setting <string, string> > s = ss.GetSettings(_datatype.DataTypeDefinitionId); ss.Dispose(); if (s.Find(set => set.Key == kv.Key).Value != null) { dst.Value = s.Find(set => set.Key == kv.Key).Value; } } panel.Controls.Add(dst.RenderControl(kv.Value)); Label invalid = new Label(); invalid.Attributes.Add("style", "color:#8A1F11"); invalid.ID = "lbl" + kv.Key; panel.Controls.Add(invalid); _phSettings.Controls.Add(panel); } } }
private void LoadSetttings(string fileName) { if (System.IO.File.Exists(IOHelper.MapPath("~/" + fileName))) { UserControl oControl = (UserControl)this.Page.LoadControl(@"~/" + fileName); Type type = oControl.GetType(); Dictionary <string, DataEditorSetting> settings = GetSettings(type); foreach (KeyValuePair <string, DataEditorSetting> kv in settings) { DataEditorSettingType dst = kv.Value.GetDataEditorSettingType(); dtSettings.Add(kv.Key, dst); DataEditorPropertyPanel panel = new DataEditorPropertyPanel(); panel.Text = kv.Value.GetName(); panel.Text += "<br/><small>" + kv.Value.description + "</small>"; if (HasSettings(type)) { DataEditorSettingsStorage ss = new DataEditorSettingsStorage(); List <Setting <string, string> > s = ss.GetSettings(_datatype.DataTypeDefinitionId); ss.Dispose(); if (s.Find(set => set.Key == kv.Key).Value != null) { dst.Value = s.Find(set => set.Key == kv.Key).Value; } } panel.Controls.Add(dst.RenderControl(kv.Value)); _phSettings.Controls.Add(panel); } } }
private void LoadSetttings(string fileName) { if (System.IO.File.Exists(IOHelper.MapPath("~/" + fileName))) { UserControl oControl = (UserControl)this.Page.LoadControl(@"~/" + fileName); Type type = oControl.GetType(); Dictionary<string, DataEditorSetting> settings = GetSettings(type); foreach (KeyValuePair<string, DataEditorSetting> kv in settings) { DataEditorSettingType dst = kv.Value.GetDataEditorSettingType(); dtSettings.Add(kv.Key, dst); DataEditorPropertyPanel panel = new DataEditorPropertyPanel(); panel.Text = kv.Value.GetName(); panel.Text += "<br/><small>" + kv.Value.description + "</small>"; if (HasSettings(type)) { DataEditorSettingsStorage ss = new DataEditorSettingsStorage(); List<Setting<string, string>> s = ss.GetSettings(_datatype.DataTypeDefinitionId); ss.Dispose(); if (s.Find(set => set.Key == kv.Key).Value != null) dst.Value = s.Find(set => set.Key == kv.Key).Value; } panel.Controls.Add(dst.RenderControl(kv.Value)); _phSettings.Controls.Add(panel); } } }